diff options
Diffstat (limited to 'src/main.cpp')
-rw-r--r-- | src/main.cpp | 36 |
1 files changed, 27 insertions, 9 deletions
diff --git a/src/main.cpp b/src/main.cpp index a99f3e30..e2690f4f 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -30,14 +30,18 @@ * \mainpage GpgFrontend Develop Document Main Page */ +#include <qcommandlineparser.h> +#include <qloggingcategory.h> + +// #include "GpgFrontendContext.h" +#include "core/utils/MemoryUtils.h" + +// #include "app.h" #include "cmd.h" #include "init.h" -// -#include "core/utils/MemoryUtils.h" - /** * * @param argc @@ -45,15 +49,31 @@ * @return */ auto main(int argc, char* argv[]) -> int { + // initialize qt resources + Q_INIT_RESOURCE(gpgfrontend); + GpgFrontend::GFCxtSPtr const ctx = GpgFrontend::SecureCreateSharedObject<GpgFrontend::GpgFrontendContext>( argc, argv); ctx->InitApplication(); - auto rtn = 0; +#ifdef RELEASE + QLoggingCategory::setFilterRules("*.debug=false\n*.info=false\n"); + qSetMessagePattern( + "[%{time yyyyMMdd h:mm:ss.zzz}] [%{category}] " + "[%{if-debug}D%{endif}%{if-info}I%{endif}%{if-warning}W%{endif}%{if-" + "critical}C%{endif}%{if-fatal}F%{endif}] [%{threadid}] - " + "%{message}"); +#else + QLoggingCategory::setFilterRules("*.debug=false"); + qSetMessagePattern( + "[%{time yyyyMMdd h:mm:ss.zzz}] [%{category}] " + "[%{if-debug}D%{endif}%{if-info}I%{endif}%{if-warning}W%{endif}%{if-" + "critical}C%{endif}%{if-fatal}F%{endif}] [%{threadid}] %{file}:%{line} - " + "%{message}"); +#endif - // initialize qt resources - Q_INIT_RESOURCE(gpgfrontend); + auto rtn = 0; QCommandLineParser parser; parser.addHelpOption(); @@ -67,14 +87,12 @@ auto main(int argc, char* argv[]) -> int { parser.process(*ctx->GetApp()); - ctx->log_level = spdlog::level::info; - if (parser.isSet("v")) { return GpgFrontend::PrintVersion(); } if (parser.isSet("l")) { - ctx->log_level = GpgFrontend::ParseLogLevel(parser.value("l")); + GpgFrontend::ParseLogLevel(parser.value("l")); } if (parser.isSet("t")) { |