mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2025-01-18 15:15:37 +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;
|
return 1;
|
||||||
|
|
||||||
//start the logger
|
//start the logger
|
||||||
|
Log::init();
|
||||||
Log::open();
|
Log::open();
|
||||||
LOG(LogInfo) << "EmulationStation - v" << PROGRAM_VERSION_STRING << ", built " << PROGRAM_BUILT_STRING;
|
LOG(LogInfo) << "EmulationStation - v" << PROGRAM_VERSION_STRING << ", built " << PROGRAM_BUILT_STRING;
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include <stdio.h>
|
||||||
#include "platform.h"
|
#include "platform.h"
|
||||||
|
|
||||||
LogLevel Log::reportingLevel = LogInfo;
|
LogLevel Log::reportingLevel = LogInfo;
|
||||||
|
@ -23,6 +24,14 @@ void Log::setReportingLevel(LogLevel level)
|
||||||
reportingLevel = 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()
|
void Log::open()
|
||||||
{
|
{
|
||||||
file = fopen(getLogPath().c_str(), "w");
|
file = fopen(getLogPath().c_str(), "w");
|
||||||
|
|
|
@ -24,6 +24,7 @@ public:
|
||||||
static std::string getLogPath();
|
static std::string getLogPath();
|
||||||
|
|
||||||
static void flush();
|
static void flush();
|
||||||
|
static void init();
|
||||||
static void open();
|
static void open();
|
||||||
static void close();
|
static void close();
|
||||||
protected:
|
protected:
|
||||||
|
|
Loading…
Reference in a new issue