1
0
Fork 0

Log to file inside FG_HOME.

This commit is contained in:
James Turner 2013-02-06 19:05:33 +01:00
parent 240f98d0f3
commit 0ced6a24a0

View file

@ -313,6 +313,18 @@ int fgMainInit( int argc, char **argv ) {
SG_LOG( SG_GENERAL, SG_ALERT, "Config option parsing failed ..." );
exit(-1);
}
SGPath logPath = globals->get_fg_home();
logPath.append("fgfs.log");
if (logPath.exists()) {
SGPath prevLogPath = globals->get_fg_home();
prevLogPath.append("fgfs_0.log");
logPath.rename(prevLogPath);
// bit strange, we need to restore the correct value of logPath now
logPath = globals->get_fg_home();
logPath.append("fgfs.log");
}
sglog().logToFile(logPath, SG_ALL, SG_INFO);
// Initialize the Window/Graphics environment.
fgOSInit(&argc, argv);