diff options
Diffstat (limited to 'main')
-rw-r--r-- | main/main.cpp | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/main/main.cpp b/main/main.cpp index bb4751c61d..a500e173a2 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -954,21 +954,6 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph } #endif - GLOBAL_DEF("logging/file_logging/enable_file_logging", false); - // Only file logging by default on desktop platforms as logs can't be - // accessed easily on mobile/Web platforms (if at all). - // This also prevents logs from being created for the editor instance, as feature tags - // are disabled while in the editor (even if they should logically apply). - GLOBAL_DEF("logging/file_logging/enable_file_logging.pc", true); - GLOBAL_DEF("logging/file_logging/log_path", "user://logs/godot.log"); - GLOBAL_DEF("logging/file_logging/max_log_files", 5); - ProjectSettings::get_singleton()->set_custom_property_info("logging/file_logging/max_log_files", PropertyInfo(Variant::INT, "logging/file_logging/max_log_files", PROPERTY_HINT_RANGE, "0,20,1,or_greater")); //no negative numbers - 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))); - } - #ifdef TOOLS_ENABLED if (editor) { Engine::get_singleton()->set_editor_hint(true); @@ -985,6 +970,23 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph } #endif + GLOBAL_DEF("logging/file_logging/enable_file_logging", false); + // Only file logging by default on desktop platforms as logs can't be + // accessed easily on mobile/Web platforms (if at all). + // This also prevents logs from being created for the editor instance, as feature tags + // are disabled while in the editor (even if they should logically apply). + GLOBAL_DEF("logging/file_logging/enable_file_logging.pc", true); + GLOBAL_DEF("logging/file_logging/log_path", "user://logs/godot.log"); + GLOBAL_DEF("logging/file_logging/max_log_files", 5); + ProjectSettings::get_singleton()->set_custom_property_info("logging/file_logging/max_log_files", PropertyInfo(Variant::INT, "logging/file_logging/max_log_files", PROPERTY_HINT_RANGE, "0,20,1,or_greater")); //no negative numbers + if (!project_manager && !editor && FileAccess::get_create_func(FileAccess::ACCESS_USERDATA) && GLOBAL_GET("logging/file_logging/enable_file_logging")) { + // Don't create logs for the project manager as they would be written to + // the current working directory, which is inconvenient. + 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 (main_args.size() == 0 && String(GLOBAL_DEF("application/run/main_scene", "")) == "") { #ifdef TOOLS_ENABLED if (!editor && !project_manager) { |