aboutsummaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp23
1 files changed, 8 insertions, 15 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 0072b04..dfe58de 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -21,10 +21,7 @@
#include <QTranslator>
#include <memory>
#include <plugininterface.h>
-#ifdef _WIN32
-#include <cstdio>
-#include <windows.h>
-#endif
+#include <spdlog/spdlog.h>
#include "config.h"
#if defined(CONFIG_USEPLASMA) && !defined(PLASMA)
@@ -37,12 +34,10 @@
int main(int argc, char **argv)
{
- // a beautiful hack to be able to write to stdout on Windows
-#ifdef _WIN32
- if(AttachConsole(ATTACH_PARENT_PROCESS)) {
- freopen("CONOUT$", "w", stdout);
- freopen("CONOUT$", "w", stderr);
- }
+ // change log pattern
+ spdlog::set_pattern("[%^%l%$] [%P:%t] %v");
+#ifdef QT_DEBUG
+ spdlog::set_level(spdlog::level::debug); // Set global log level to debug
#endif
const std::unique_ptr<CommandLine> cmd = std::make_unique<CommandLine>(argc, argv);
@@ -77,16 +72,14 @@ int main(int argc, char **argv)
for(const QString &path : Util::files(config->value<QString>("plugins.path").value())) {
auto *loader = new QPluginLoader(path);
const bool loaded = loader->load();
-#ifdef QT_DEBUG
- qDebug("Loading plugin %s %s", qUtf8Printable(path), loaded ? "[ok]" : "[failed]");
-#endif
+ spdlog::info("{} plugin {}", loaded ? "Loaded" : "Failed to load", qUtf8Printable(path));
if(loaded) {
plugins.append(loader);
auto *plugin = qobject_cast<PluginInterface *>(loader->instance());
pluginCommands.unite(plugin->commands());
} else {
- qDebug("%s", qUtf8Printable(loader->errorString()));
+ spdlog::warn("{}", qUtf8Printable(loader->errorString()));
delete loader;
}
}
@@ -131,7 +124,7 @@ int main(int argc, char **argv)
google_breakpad::ExceptionHandler eh(descriptor, nullptr, CrashHandler::dumpCallback, &ctx, true, -1);
#ifdef QT_DEBUG
- qDebug("Installed breakpad exception handler (path=%s)", crashpath.c_str());
+ spdlog::info("Installed breakpad exception handler (path {})", crashpath);
#endif
#endif // CONFIG_USEBREAKPAD