Set log levels after commandline options are parsed. Fixes --verbose, --quiet and --log-levels

This commit is contained in:
David Sansome 2014-10-04 21:22:29 +10:00
parent eec246718a
commit 0b97a29aa1
1 changed files with 5 additions and 4 deletions

View File

@ -286,14 +286,14 @@ int main(int argc, char* argv[]) {
RegisterMetaTypes(); RegisterMetaTypes();
CommandlineOptions options(argc, argv); // Initialise logging. Log levels are set after the commandline options are
// parsed below.
// Initialise logging
logging::Init(); logging::Init();
logging::SetLevels(options.log_levels());
g_log_set_default_handler(reinterpret_cast<GLogFunc>(&logging::GLog), g_log_set_default_handler(reinterpret_cast<GLogFunc>(&logging::GLog),
nullptr); nullptr);
CommandlineOptions options(argc, argv);
{ {
// Only start a core application now so we can check if there's another // Only start a core application now so we can check if there's another
// Clementine running without needing an X server. // 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 // Parse commandline options - need to do this before starting the
// full QApplication so it works without an X server // full QApplication so it works without an X server
if (!options.Parse()) return 1; if (!options.Parse()) return 1;
logging::SetLevels(options.log_levels());
if (a.isRunning()) { if (a.isRunning()) {
if (options.is_empty()) { if (options.is_empty()) {