Merge pull request #267 from ricardoianelli/master
Rework on init/exit log messages.
This commit is contained in:
commit
25841e9c77
5
init.lua
5
init.lua
|
@ -3,6 +3,7 @@
|
|||
|
||||
-- setup logger
|
||||
g_logger.setLogFile(g_resources.getWorkDir() .. g_app.getCompactName() .. ".log")
|
||||
g_logger.info(os.date("== application started at %b %d %Y %X"))
|
||||
|
||||
-- print first terminal message
|
||||
g_logger.info(g_app.getName() .. ' ' .. g_app.getVersion() .. ' rev ' .. g_app.getBuildRevision() .. ' (' .. g_app.getBuildCommit() .. ') built on ' .. g_app.getBuildDate() .. ' for arch ' .. g_app.getBuildArch())
|
||||
|
@ -48,7 +49,7 @@ g_modules.ensureModuleLoaded("game_interface")
|
|||
g_modules.autoLoadModules(9999)
|
||||
|
||||
local script = '/' .. g_app.getCompactName() .. 'rc'
|
||||
|
||||
if g_resources.fileExists(script) then
|
||||
dofile(script)
|
||||
end
|
||||
|
||||
end
|
|
@ -53,6 +53,9 @@ function startup()
|
|||
end
|
||||
|
||||
function init()
|
||||
connect(g_app, { onRun = startup,
|
||||
onClose = exit })
|
||||
|
||||
g_window.setMinimumSize({ width = 600, height = 480 })
|
||||
g_sounds.preload(musicFilename)
|
||||
|
||||
|
@ -91,12 +94,12 @@ function init()
|
|||
if not g_crypt.setMachineUUID(g_configs.get('uuid')) then
|
||||
g_configs.set('uuid', g_crypt.getMachineUUID())
|
||||
g_configs.save()
|
||||
end
|
||||
|
||||
connect(g_app, { onRun = startup })
|
||||
end
|
||||
end
|
||||
|
||||
function terminate()
|
||||
disconnect(g_app, { onRun = startup,
|
||||
onClose = exit })
|
||||
-- save window configs
|
||||
g_settings.set('window-size', g_window.getUnmaximizedSize())
|
||||
g_settings.set('window-pos', g_window.getUnmaximizedPos())
|
||||
|
@ -107,3 +110,7 @@ function terminate()
|
|||
g_settings.set('protocol-version', protocolVersion)
|
||||
end
|
||||
end
|
||||
|
||||
function exit()
|
||||
g_logger.info("Exiting application..")
|
||||
end
|
|
@ -153,7 +153,6 @@ void Application::poll()
|
|||
void Application::exit()
|
||||
{
|
||||
m_stopping = true;
|
||||
g_logger.info("Exiting application..");
|
||||
}
|
||||
|
||||
void Application::close()
|
||||
|
|
|
@ -129,7 +129,5 @@ void Logger::setLogFile(const std::string& file)
|
|||
g_logger.error(stdext::format("Unable to save log to '%s'", file));
|
||||
return;
|
||||
}
|
||||
|
||||
m_outFile << "\n== application started at " << stdext::date_time_string() << std::endl;
|
||||
m_outFile.flush();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue