diff --git a/es-app/src/main.cpp b/es-app/src/main.cpp index 49bd9c058..46085e591 100644 --- a/es-app/src/main.cpp +++ b/es-app/src/main.cpp @@ -222,6 +222,7 @@ int main(int argc, char* argv[]) return 1; //start the logger + Log::init(); Log::open(); LOG(LogInfo) << "EmulationStation - v" << PROGRAM_VERSION_STRING << ", built " << PROGRAM_BUILT_STRING; diff --git a/es-core/src/Log.cpp b/es-core/src/Log.cpp index 643aef16a..811bbb8cc 100644 --- a/es-core/src/Log.cpp +++ b/es-core/src/Log.cpp @@ -2,6 +2,7 @@ #include #include #include +#include #include "platform.h" LogLevel Log::reportingLevel = LogInfo; @@ -23,6 +24,14 @@ void Log::setReportingLevel(LogLevel level) reportingLevel = level; } +void Log::init() +{ + remove((getLogPath() + ".bak").c_str()); + // rename previous log file + rename(getLogPath().c_str(), (getLogPath() + ".bak").c_str()); + return; +} + void Log::open() { file = fopen(getLogPath().c_str(), "w"); diff --git a/es-core/src/Log.h b/es-core/src/Log.h index fbc033d40..b0f985984 100644 --- a/es-core/src/Log.h +++ b/es-core/src/Log.h @@ -24,6 +24,7 @@ public: static std::string getLogPath(); static void flush(); + static void init(); static void open(); static void close(); protected: