Moving start messages to lua
Moved start log messages to lua, to make easier to enable/disable those messages.
This commit is contained in:
parent
7f918a12a2
commit
cbeab6f9b0
6
init.lua
6
init.lua
|
@ -3,13 +3,14 @@
|
||||||
|
|
||||||
-- setup logger
|
-- setup logger
|
||||||
g_logger.setLogFile(g_resources.getWorkDir() .. g_app.getCompactName() .. ".log")
|
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
|
-- 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())
|
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())
|
||||||
|
|
||||||
-- add data directory to the search path
|
-- add data directory to the search path
|
||||||
if not g_resources.addSearchPath(g_resources.getWorkDir() .. "data", true) then
|
if not g_resources.addSearchPath(g_resources.getWorkDir() .. "data", true) then
|
||||||
g_logger.fatal("Unable to add data directory to the search path.")
|
g_logger.fatal("Unable to add data directory to the search path.")
|
||||||
end
|
end
|
||||||
|
|
||||||
-- add modules directory to the search path
|
-- add modules directory to the search path
|
||||||
|
@ -50,5 +51,4 @@ g_modules.autoLoadModules(9999)
|
||||||
local script = '/' .. g_app.getCompactName() .. 'rc'
|
local script = '/' .. g_app.getCompactName() .. 'rc'
|
||||||
if g_resources.fileExists(script) then
|
if g_resources.fileExists(script) then
|
||||||
dofile(script)
|
dofile(script)
|
||||||
end
|
end
|
||||||
|
|
|
@ -93,7 +93,10 @@ function init()
|
||||||
g_configs.save()
|
g_configs.save()
|
||||||
end
|
end
|
||||||
|
|
||||||
connect(g_app, { onRun = startup })
|
connect(g_app, {
|
||||||
|
onRun = startup,
|
||||||
|
onClose = exit,
|
||||||
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
function terminate()
|
function terminate()
|
||||||
|
@ -107,3 +110,7 @@ function terminate()
|
||||||
g_settings.set('protocol-version', protocolVersion)
|
g_settings.set('protocol-version', protocolVersion)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function exit()
|
||||||
|
g_logger.info("Exiting application..")
|
||||||
|
end
|
|
@ -153,7 +153,6 @@ void Application::poll()
|
||||||
void Application::exit()
|
void Application::exit()
|
||||||
{
|
{
|
||||||
m_stopping = true;
|
m_stopping = true;
|
||||||
g_logger.info("Exiting application..");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Application::close()
|
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));
|
g_logger.error(stdext::format("Unable to save log to '%s'", file));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_outFile << "\n== application started at " << stdext::date_time_string() << std::endl;
|
|
||||||
m_outFile.flush();
|
m_outFile.flush();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue