1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-07 12:30:27 +00:00

Return and repair file logging

And make it configurable, too.
This commit is contained in:
Ruslan Mustakov
2017-11-21 16:35:01 +07:00
parent c846e49a7d
commit d42c5646a5
19 changed files with 60 additions and 81 deletions

View File

@@ -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");