aboutsummaryrefslogtreecommitdiff
path: root/src/libutil
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2021-12-09 15:31:08 +0100
committerGitHub <noreply@github.com>2021-12-09 15:31:08 +0100
commitbc57b3854e75d3f20929fd63d69a98b8237f23b2 (patch)
treeda2287e97f3934dba473cbfeeb1748125760a6de /src/libutil
parent75654bacc571bf4c193599ecd68f7c94d63994e7 (diff)
parent1f15441103caab1b41317a6107fc2560eb109a4a (diff)
Merge pull request #5695 from obsidiansystems/tidy-logging
Tidy up the logging
Diffstat (limited to 'src/libutil')
-rw-r--r--src/libutil/logging.hh5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/libutil/logging.hh b/src/libutil/logging.hh
index 96ad69790..ce9c3dfed 100644
--- a/src/libutil/logging.hh
+++ b/src/libutil/logging.hh
@@ -189,13 +189,14 @@ extern Verbosity verbosity; /* suppress msgs > this */
/* Print a string message if the current log level is at least the specified
level. Note that this has to be implemented as a macro to ensure that the
arguments are evaluated lazily. */
-#define printMsg(level, args...) \
+#define printMsgUsing(loggerParam, level, args...) \
do { \
auto __lvl = level; \
if (__lvl <= nix::verbosity) { \
- logger->log(__lvl, fmt(args)); \
+ loggerParam->log(__lvl, fmt(args)); \
} \
} while (0)
+#define printMsg(level, args...) printMsgUsing(logger, level, args)
#define printError(args...) printMsg(lvlError, args)
#define notice(args...) printMsg(lvlNotice, args)