mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Move debug.txt after it grows too big (#8904)
Before opening the file for writing, its file size is tested. If it exceeds 50 MB, it is moved to debut.txt.1, otherwise the log is appended to the old messages. An old debut.txt.1 is removed if it already exists.
This commit is contained in:
parent
2c9edefde3
commit
36bfc67574
5 changed files with 33 additions and 11 deletions
|
@ -172,7 +172,7 @@ int main(int argc, char *argv[])
|
|||
} else {
|
||||
errorstream << "Invalid --worldlist value: "
|
||||
<< cmd_args.get("worldlist") << std::endl;
|
||||
return 1;
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -426,7 +426,7 @@ static bool setup_log_params(const Settings &cmd_args)
|
|||
} else {
|
||||
errorstream << "Invalid color mode: " << color_mode << std::endl;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If trace is enabled, enable logging of certain things
|
||||
|
@ -580,9 +580,8 @@ static void init_log_streams(const Settings &cmd_args)
|
|||
"using maximum." << std::endl;
|
||||
}
|
||||
|
||||
verbosestream << "log_filename = " << log_filename << std::endl;
|
||||
|
||||
file_log_output.open(log_filename);
|
||||
file_log_output.setFile(log_filename,
|
||||
g_settings->getU64("debug_log_size_max") * 1000000);
|
||||
g_logger.addOutputMaxLevel(&file_log_output, log_level);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue