diff options
| author | Dirk-Jan C. Binnema <djcb@djcbsoftware.nl> | 2025-11-01 09:31:07 +0200 |
|---|---|---|
| committer | Dirk-Jan C. Binnema <djcb@djcbsoftware.nl> | 2025-11-01 09:44:02 +0200 |
| commit | d3ffb4ca2c77b92dc98caa336c5d200a790912d2 (patch) | |
| tree | 3b0b87881dd6af59f751567e61c6b4ca6d55da24 /lib | |
| parent | 7ac3b383237abd1eef6981e4d8cedaec4b7c8ad7 (diff) | |
logging: don't g_message with --quiet
When `--quiet` is passed (and not --debug), do not log with g_message at
startup.
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/utils/mu-logger.cc | 7 | ||||
| -rw-r--r-- | lib/utils/mu-logger.hh | 8 |
2 files changed, 8 insertions, 7 deletions
diff --git a/lib/utils/mu-logger.cc b/lib/utils/mu-logger.cc index c9a0d74..8715bff 100644 --- a/lib/utils/mu-logger.cc +++ b/lib/utils/mu-logger.cc @@ -184,9 +184,10 @@ Mu::Logger::Logger(const std::string& path, Mu::Logger::Options opts) NULL, NULL); - g_message("logging initialized; debug: %s, stdout/stderr: %s", - any_of(opts & Options::Debug) ? "yes" : "no", - any_of(opts & Options::StdOutErr) ? "yes" : "no"); + if (none_of(opts & Options::Quiet)) + g_message("logging initialized; debug: %s, stdout/stderr: %s", + any_of(opts & Options::Debug) ? "yes" : "no", + any_of(opts & Options::StdOutErr) ? "yes" : "no"); MuLogInitialized = true; } diff --git a/lib/utils/mu-logger.hh b/lib/utils/mu-logger.hh index 6024e28..62680f5 100644 --- a/lib/utils/mu-logger.hh +++ b/lib/utils/mu-logger.hh @@ -1,5 +1,5 @@ /* -** Copyright (C) 2020-2023 Dirk-Jan C. Binnema <djcb@djcbsoftware.nl> +** Copyright (C) 2020-2025 Dirk-Jan C. Binnema <djcb@djcbsoftware.nl> ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the @@ -30,17 +30,17 @@ namespace Mu { * RAII object for handling logging (through g_(debug|warning|...)) * */ -struct Logger { - +class Logger { +public: /** * Logging options - * */ enum struct Options { None = 0, /**< Nothing specific */ StdOutErr = 1 << 1, /**< Log to stdout/stderr */ File = 1 << 2, /**< Force logging to file, even if journal available */ Debug = 1 << 3, /**< Include debug-level logs */ + Quiet = 1 << 4, /**< Be more quiet */ }; /** |
