logging: don't g_message with --quiet
When `--quiet` is passed (and not --debug), do not log with g_message at startup.
This commit is contained in:
@ -184,6 +184,7 @@ Mu::Logger::Logger(const std::string& path, Mu::Logger::Options opts)
|
|||||||
NULL,
|
NULL,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
|
if (none_of(opts & Options::Quiet))
|
||||||
g_message("logging initialized; debug: %s, stdout/stderr: %s",
|
g_message("logging initialized; debug: %s, stdout/stderr: %s",
|
||||||
any_of(opts & Options::Debug) ? "yes" : "no",
|
any_of(opts & Options::Debug) ? "yes" : "no",
|
||||||
any_of(opts & Options::StdOutErr) ? "yes" : "no");
|
any_of(opts & Options::StdOutErr) ? "yes" : "no");
|
||||||
|
|||||||
@ -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
|
** 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
|
** 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|...))
|
* RAII object for handling logging (through g_(debug|warning|...))
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
struct Logger {
|
class Logger {
|
||||||
|
public:
|
||||||
/**
|
/**
|
||||||
* Logging options
|
* Logging options
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
enum struct Options {
|
enum struct Options {
|
||||||
None = 0, /**< Nothing specific */
|
None = 0, /**< Nothing specific */
|
||||||
StdOutErr = 1 << 1, /**< Log to stdout/stderr */
|
StdOutErr = 1 << 1, /**< Log to stdout/stderr */
|
||||||
File = 1 << 2, /**< Force logging to file, even if journal available */
|
File = 1 << 2, /**< Force logging to file, even if journal available */
|
||||||
Debug = 1 << 3, /**< Include debug-level logs */
|
Debug = 1 << 3, /**< Include debug-level logs */
|
||||||
|
Quiet = 1 << 4, /**< Be more quiet */
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
4
mu/mu.cc
4
mu/mu.cc
@ -112,8 +112,12 @@ main(int argc, char* argv[]) try
|
|||||||
Logger::Options lopts{Logger::Options::None};
|
Logger::Options lopts{Logger::Options::None};
|
||||||
if (opts.log_stderr)
|
if (opts.log_stderr)
|
||||||
lopts |= Logger::Options::StdOutErr;
|
lopts |= Logger::Options::StdOutErr;
|
||||||
|
|
||||||
if (opts.debug)
|
if (opts.debug)
|
||||||
lopts |= Logger::Options::Debug;
|
lopts |= Logger::Options::Debug;
|
||||||
|
else if (opts.quiet) // ie. only consider when not in debug mode
|
||||||
|
lopts |= Logger::Options::Quiet;
|
||||||
|
|
||||||
if (!!g_getenv("MU_TEST"))
|
if (!!g_getenv("MU_TEST"))
|
||||||
lopts |= Logger::Options::File;
|
lopts |= Logger::Options::File;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user