Disable file logging for the project manager
Due to `user://` returning the current working directory when no project is open, this caused logs to be written to `$HOME` most of the time. This closes #40305.
This commit is contained in:
parent
1bb66f04c8
commit
b89dc6ae00
1 changed files with 17 additions and 15 deletions
|
@ -954,21 +954,6 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
|
||||||
}
|
}
|
||||||
#endif
|
#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
|
#ifdef TOOLS_ENABLED
|
||||||
if (editor) {
|
if (editor) {
|
||||||
Engine::get_singleton()->set_editor_hint(true);
|
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
|
#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", "")) == "") {
|
if (main_args.size() == 0 && String(GLOBAL_DEF("application/run/main_scene", "")) == "") {
|
||||||
#ifdef TOOLS_ENABLED
|
#ifdef TOOLS_ENABLED
|
||||||
if (!editor && !project_manager) {
|
if (!editor && !project_manager) {
|
||||||
|
|
Loading…
Reference in a new issue