mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2025-01-18 07:05:39 +00:00
Merge pull request #194 from pjft/Log-backup
Backup previous session's Log file
This commit is contained in:
commit
44d2e7dbab
|
@ -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;
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <iostream>
|
||||
#include <stdio.h>
|
||||
#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");
|
||||
|
|
|
@ -24,6 +24,7 @@ public:
|
|||
static std::string getLogPath();
|
||||
|
||||
static void flush();
|
||||
static void init();
|
||||
static void open();
|
||||
static void close();
|
||||
protected:
|
||||
|
|
Loading…
Reference in a new issue