mirror of
https://github.com/WarmUpTill/SceneSwitcher.git
synced 2026-10-01 05:49:48 -05:00
Add log level which prints performed actions
This commit is contained in:
@@ -134,8 +134,11 @@ void ActionQueue::RunActions()
|
||||
continue;
|
||||
}
|
||||
|
||||
vblog(LOG_INFO, "Performing action '%s' in queue '%s'",
|
||||
action->GetId().c_str(), _name.c_str());
|
||||
if (ActionLoggingEnabled()) {
|
||||
blog(LOG_INFO, "Performing action '%s' in queue '%s'",
|
||||
action->GetId().c_str(), _name.c_str());
|
||||
action->LogAction();
|
||||
}
|
||||
action->PerformAction();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,16 @@ namespace advss {
|
||||
|
||||
bool VerboseLoggingEnabled()
|
||||
{
|
||||
return GetSwitcher() && GetSwitcher()->verbose;
|
||||
return GetSwitcher() &&
|
||||
GetSwitcher()->logLevel == SwitcherData::LogLevel::VERBOSE;
|
||||
}
|
||||
|
||||
bool ActionLoggingEnabled()
|
||||
{
|
||||
return GetSwitcher() &&
|
||||
(GetSwitcher()->logLevel ==
|
||||
SwitcherData::LogLevel::PRINT_ACTION ||
|
||||
GetSwitcher()->logLevel == SwitcherData::LogLevel::VERBOSE);
|
||||
}
|
||||
|
||||
} // namespace advss
|
||||
|
||||
@@ -3,14 +3,26 @@
|
||||
|
||||
namespace advss {
|
||||
|
||||
// Print log with "[adv-ss] " prefix
|
||||
#define blog(level, msg, ...) blog(level, "[adv-ss] " msg, ##__VA_ARGS__)
|
||||
// Print log with "[adv-ss] " if log level is set to "verbose"
|
||||
#define vblog(level, msg, ...) \
|
||||
do { \
|
||||
if (VerboseLoggingEnabled()) { \
|
||||
blog(level, msg, ##__VA_ARGS__); \
|
||||
} \
|
||||
} while (0)
|
||||
// Print log with "[adv-ss] " if log level is set to "action" or "verbose"
|
||||
#define ablog(level, msg, ...) \
|
||||
do { \
|
||||
if (ActionLoggingEnabled()) { \
|
||||
blog(level, msg, ##__VA_ARGS__); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
// Returns true if log level is set to "verbose"
|
||||
EXPORT bool VerboseLoggingEnabled();
|
||||
// Returns true if log level is set to "action" or "verbose"
|
||||
EXPORT bool ActionLoggingEnabled();
|
||||
|
||||
} // namespace advss
|
||||
|
||||
Reference in New Issue
Block a user