From 0b97a29aa16b824d26bae097da720815ba808563 Mon Sep 17 00:00:00 2001 From: David Sansome Date: Sat, 4 Oct 2014 21:22:29 +1000 Subject: [PATCH] Set log levels after commandline options are parsed. Fixes --verbose, --quiet and --log-levels --- src/main.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 61675cf91..3eb1a9bf9 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -286,14 +286,14 @@ int main(int argc, char* argv[]) { RegisterMetaTypes(); - CommandlineOptions options(argc, argv); - - // Initialise logging + // Initialise logging. Log levels are set after the commandline options are + // parsed below. logging::Init(); - logging::SetLevels(options.log_levels()); g_log_set_default_handler(reinterpret_cast(&logging::GLog), nullptr); + CommandlineOptions options(argc, argv); + { // Only start a core application now so we can check if there's another // Clementine running without needing an X server. @@ -306,6 +306,7 @@ int main(int argc, char* argv[]) { // Parse commandline options - need to do this before starting the // full QApplication so it works without an X server if (!options.Parse()) return 1; + logging::SetLevels(options.log_levels()); if (a.isRunning()) { if (options.is_empty()) {