summaryrefslogtreecommitdiffstats
path: root/main/main.cpp
diff options
context:
space:
mode:
authorHugo Locurcio <hugo.locurcio@hugo.pro>2020-07-04 16:59:49 +0200
committerHugo Locurcio <hugo.locurcio@hugo.pro>2020-07-08 18:57:25 +0200
commit20af28ec0651da256e2c9ccefc868ea028c73a4a (patch)
treea4cc72c6aaabf5e52e45f1613c32944b0bbf1f39 /main/main.cpp
parent597b268150b208f3d3edf4410b5f6741e1d153f4 (diff)
downloadredot-engine-20af28ec0651da256e2c9ccefc868ea028c73a4a.tar.gz
Enable file logging by default on desktops to help with troubleshooting
- Use the `.log` file extension (recognized on Windows out of the box) to better hint that generated files are logs. Some editors provide dedicated syntax highlighting for those files. - Use an underscore to separate the basename from the date and the date from the time in log filenames. This makes the filename easier to read. - Keep only 5 log files by default to decrease disk usage in case messages are spammed.
Diffstat (limited to 'main/main.cpp')
-rw-r--r--main/main.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/main/main.cpp b/main/main.cpp
index 608b4a7c4d..f78990c590 100644
--- a/main/main.cpp
+++ b/main/main.cpp
@@ -954,8 +954,13 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
#endif
GLOBAL_DEF("logging/file_logging/enable_file_logging", false);
- GLOBAL_DEF("logging/file_logging/log_path", "user://logs/log.txt");
- GLOBAL_DEF("logging/file_logging/max_log_files", 10);
+ // 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");