Add log level to log executed macros

This commit is contained in:
WarmUpTill
2024-08-27 23:15:44 +02:00
committed by WarmUpTill
parent e729d15e97
commit 36fb83246b
8 changed files with 45 additions and 9 deletions

View File

@@ -12,9 +12,15 @@ bool VerboseLoggingEnabled()
bool ActionLoggingEnabled()
{
return GetSwitcher() &&
(GetSwitcher()->logLevel ==
SwitcherData::LogLevel::PRINT_ACTION ||
GetSwitcher()->logLevel == SwitcherData::LogLevel::VERBOSE);
(GetSwitcher()->logLevel == SwitcherData::LogLevel::LOG_ACTION ||
VerboseLoggingEnabled());
}
bool MacroLoggingEnabled()
{
return GetSwitcher() &&
(GetSwitcher()->logLevel == SwitcherData::LogLevel::LOG_MACRO ||
ActionLoggingEnabled());
}
} // namespace advss

View File

@@ -27,6 +27,13 @@ namespace advss {
blog(level, msg, ##__VA_ARGS__); \
} \
} while (0)
// Print log with "[adv-ss] " if log level is set to "macro", "action" or "verbose"
#define mblog(level, msg, ...) \
do { \
if (MacroLoggingEnabled()) { \
blog(level, msg, ##__VA_ARGS__); \
} \
} while (0)
#endif
@@ -34,5 +41,7 @@ namespace advss {
EXPORT bool VerboseLoggingEnabled();
// Returns true if log level is set to "action" or "verbose"
EXPORT bool ActionLoggingEnabled();
// Returns true if log level is set to "macro", "action" or "verbose"
EXPORT bool MacroLoggingEnabled();
} // namespace advss