diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2017-11-21 14:25:33 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-11-21 14:25:33 +0100 |
commit | 6c9ee1f125dc45625eb32d08e623857058cf30ad (patch) | |
tree | 17905ea2dfe3eaa6c5229c6c55d487e7a8c0ca46 /main | |
parent | fee2f367afc234afa541667ab800e2f65297e6bc (diff) | |
parent | d42c5646a584eb0a5ea469dc017a2892ed9b955a (diff) |
Merge pull request #13133 from endragor/resurrect-file-logging
Return and repair file logging
Diffstat (limited to 'main')
-rwxr-xr-x | main/main.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/main/main.cpp b/main/main.cpp index 5410aae1d2..e74402d7dd 100755 --- a/main/main.cpp +++ b/main/main.cpp @@ -290,8 +290,6 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph register_core_settings(); //here globals is present - OS::get_singleton()->initialize_logger(); - translation_server = memnew(TranslationServer); performance = memnew(Performance); ClassDB::register_class<Performance>(); @@ -745,6 +743,15 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph #endif } + GLOBAL_DEF("logging/file_logging/enable_file_logging", true); + GLOBAL_DEF("logging/file_logging/log_path", "user://logs/log.txt"); + GLOBAL_DEF("logging/file_logging/max_log_files", 10); + if (FileAccess::get_create_func(FileAccess::ACCESS_USERDATA) && GLOBAL_GET("logging/file_logging/enable_file_logging")) { + String base_path = GLOBAL_GET("logging/file_logging/log_path"); + int max_files = GLOBAL_GET("logging/file_logging/max_log_files"); + OS::get_singleton()->add_logger(memnew(RotatedFileLogger(base_path, max_files))); + } + if (editor) { Engine::get_singleton()->set_editor_hint(true); main_args.push_back("--editor"); |