diff options
| author | Dan Engelbrecht <[email protected]> | 2026-04-17 14:10:02 +0200 |
|---|---|---|
| committer | GitHub Enterprise <[email protected]> | 2026-04-17 14:10:02 +0200 |
| commit | bc17147c11d2e34a287a4e2171484aa3f9e576d4 (patch) | |
| tree | 84f070b4d21fbf46b68ffd59d5d6215f8c2a8876 /src/zencore | |
| parent | operationlogoutput refactor (#967) (diff) | |
| download | archived-zen-bc17147c11d2e34a287a4e2171484aa3f9e576d4.tar.xz archived-zen-bc17147c11d2e34a287a4e2171484aa3f9e576d4.zip | |
log cleanup (#969)
- Improvement: New `ZEN_SCOPED_LOG(Expr)` macro routes `ZEN_INFO`/`ZEN_WARN`/`ZEN_DEBUG` in the enclosing block through the given logger expression instead of the default
- Improvement: `BuildContainer`, `SaveOplog`, and `LoadOplogContext` now take a caller-provided `LoggerRef` so diagnostic messages route through the caller's logger
Diffstat (limited to 'src/zencore')
| -rw-r--r-- | src/zencore/include/zencore/logging.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/zencore/include/zencore/logging.h b/src/zencore/include/zencore/logging.h index 8c236d09b..cf011fb1a 100644 --- a/src/zencore/include/zencore/logging.h +++ b/src/zencore/include/zencore/logging.h @@ -175,6 +175,11 @@ using zen::Log; #define ZEN_ERROR(fmtstr, ...) ZEN_LOG_WITH_LOCATION(Log(), zen::logging::Err, fmtstr, ##__VA_ARGS__) #define ZEN_CRITICAL(fmtstr, ...) ZEN_LOG_WITH_LOCATION(Log(), zen::logging::Critical, fmtstr, ##__VA_ARGS__) +// Routes ZEN_INFO / ZEN_WARN / ZEN_DEBUG etc. in the enclosing scope through the given logger expression +// (a LoggerRef or something convertible, e.g. a member or a context field) instead of the namespace default. +// Expand at block scope; the resulting local `Log` shadows `zen::Log()` for the rest of the block. +#define ZEN_SCOPED_LOG(Expr) auto Log = [&]() { return (Expr); } + #define ZEN_CONSOLE_LOG(InLevel, fmtstr, ...) \ do \ { \ |