aboutsummaryrefslogtreecommitdiff
path: root/src/zencore
diff options
context:
space:
mode:
authorStefan Boberg <[email protected]>2023-12-11 11:00:05 +0100
committerGitHub <[email protected]>2023-12-11 11:00:05 +0100
commit3849faabb060d58fd7e056aa01445cf1ae3ab0f9 (patch)
treecc57edd3ead53129ed41fc486a6b13c2dca52af4 /src/zencore
parentSuppressConsoleLog now removes any existing console logger (#599) (diff)
downloadzen-3849faabb060d58fd7e056aa01445cf1ae3ab0f9.tar.xz
zen-3849faabb060d58fd7e056aa01445cf1ae3ab0f9.zip
multi-line logging improvements (#597)
* added ZEN_SCOPED_WARN and implemented multi-line logging * changed so file log also uses `fullformatter` for consistency and to get the multi-line support across the board
Diffstat (limited to 'src/zencore')
-rw-r--r--src/zencore/include/zencore/logging.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/zencore/include/zencore/logging.h b/src/zencore/include/zencore/logging.h
index 8b76d754c..6d44e31df 100644
--- a/src/zencore/include/zencore/logging.h
+++ b/src/zencore/include/zencore/logging.h
@@ -239,6 +239,14 @@ std::string_view EmitActivitiesForLogging(StringBuilderBase& OutString);
#define ZEN_LOG_SCOPE(...) ScopedLazyActivity $Activity##__LINE__([&](StringBuilderBase& Out) { Out << fmt::format(__VA_ARGS__); })
+#define ZEN_SCOPED_WARN(fmtstr, ...) \
+ do \
+ { \
+ ExtendableStringBuilder<256> ScopeString; \
+ const std::string_view Scopes = EmitActivitiesForLogging(ScopeString); \
+ ZEN_LOG(Log(), zen::logging::level::Warn, fmtstr "{}", ##__VA_ARGS__, Scopes); \
+ } while (false)
+
#define ZEN_SCOPED_ERROR(fmtstr, ...) \
do \
{ \