From ef05c075ba6993dc911ade281f1b512b7df9de0a Mon Sep 17 00:00:00 2001 From: William JCM Date: Wed, 30 Mar 2022 14:18:23 +0200 Subject: [PATCH] main: improve logging. --- src/main.cpp | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 170fdee..f680498 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -25,7 +25,20 @@ #include int main(int argc, char** argv) { - void* mutex_handle = CreateMutexW(nullptr, 0, L"MassBuilderSaveTool"); +#ifndef SAVETOOL_DEBUG_BUILD + std::ofstream output{"SaveToolLog.txt", std::ios::trunc|std::ios::out}; + + Utility::Debug d{&output}; + Utility::Warning w{&output}; + Utility::Error e{&output}; +#else + Utility::Warning w{Utility::Debug::defaultOutput()}; + Utility::Error e{Utility::Debug::defaultOutput()}; +#endif + + Utility::Debug{} << "===M.A.S.S. Builder Save Tool version " SAVETOOL_VERSION "==="; + + auto mutex_handle = CreateMutexW(nullptr, 0, L"MassBuilderSaveTool"); if(!mutex_handle) { SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Error initialising the app", @@ -39,14 +52,7 @@ int main(int argc, char** argv) { return EXIT_FAILURE; } -#ifndef SAVETOOL_DEBUG_BUILD - std::ofstream output{"SaveToolLog.txt", std::ios::trunc|std::ios::out}; - - Utility::Debug d{&output}; - Utility::Warning w{&output}; - Utility::Error e{&output}; -#endif - + Utility::Debug{} << "===Initialising OpenGL renderer==="; SaveTool app({argc, argv}); Int result = app.exec();