add '--log' command line parameter

This commit is contained in:
MihailRis 2026-08-03 19:54:54 +03:00
parent 8b520a3787
commit 7c9fff19e4
3 changed files with 14 additions and 1 deletions

View file

@ -7,6 +7,7 @@
#include <iostream>
#include <stdexcept>
using namespace std::literals;
static debug::Logger logger("main");
static void sigterm_handler(int signum) {
@ -36,7 +37,14 @@ int main(int argc, char** argv) {
#ifdef NDEBUG
std::signal(SIGINT, sigterm_handler);
#endif
debug::Logger::init(coreParameters.userFolder.string() + "/latest.log");
std::filesystem::path logFile = coreParameters.logFile;
if (logFile.empty()) {
logFile = coreParameters.userFolder.string() + "/latest"s +
(coreParameters.subProcessDepth > 0
? ".sub" + std::to_string(coreParameters.subProcessDepth)
: "") + ".log"s;
}
debug::Logger::init(logFile);
platform::configure_encoding();
auto& engine = Engine::getInstance();