fix: Move version print line after file outputter is created

This commit is contained in:
Nick Bolton
2025-03-04 10:40:31 +00:00
parent 3ef5793beb
commit b5d12b8aa5

View File

@ -44,8 +44,6 @@ int main(int argc, char **argv)
Log log;
EventQueue events;
LOG((CLOG_PRINT "%s daemon (v%s)", kAppName, kVersion));
auto &daemon = DaemonApp::instance();
DaemonApp::InitResult initResult;
try {
@ -58,6 +56,13 @@ int main(int argc, char **argv)
return kExitFailed;
}
// Important: Log the app name and version number to the log file after the daemon app init
// because the file log outputter is created there. Logging before would only log to stdout
// which is not useful for troubleshooting Windows services.
// It's important to write the version number to the log file so we can be certain the old daemon
// was uninstalled, since sometimes Windows services can get stuck and fail to be removed.
LOG_PRINT("%s Daemon (v%s)", kAppName, kVersion);
switch (initResult) {
using enum DaemonApp::InitResult;