mirror of
https://github.com/WarmUpTill/SceneSwitcher.git
synced 2026-08-22 09:15:57 -05:00
Improve logging for macros
This commit is contained in:
@@ -25,6 +25,7 @@ public:
|
||||
static QWidget *CreateWidget(const int id, QWidget *parent,
|
||||
std::shared_ptr<MacroAction> action);
|
||||
static auto GetActionTypes() { return _methods; }
|
||||
static std::string GetActionName(int id);
|
||||
|
||||
private:
|
||||
static std::map<int, MacroActionInfo> _methods;
|
||||
|
||||
@@ -25,6 +25,7 @@ public:
|
||||
static QWidget *CreateWidget(const int id, QWidget *parent,
|
||||
std::shared_ptr<MacroCondition>);
|
||||
static auto GetConditionTypes() { return _methods; }
|
||||
static std::string GetConditionName(int id);
|
||||
|
||||
private:
|
||||
static std::map<int, MacroConditionInfo> _methods;
|
||||
|
||||
@@ -31,6 +31,14 @@ QWidget *MacroActionFactory::CreateWidget(const int id, QWidget *parent,
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
std::string MacroActionFactory::GetActionName(int id)
|
||||
{
|
||||
if (auto it = _methods.find(id); it != _methods.end()) {
|
||||
return it->second._name;
|
||||
}
|
||||
return "unknown action";
|
||||
}
|
||||
|
||||
static inline void populateActionSelection(QComboBox *list)
|
||||
{
|
||||
for (auto entry : MacroActionFactory::GetActionTypes()) {
|
||||
|
||||
@@ -29,6 +29,14 @@ MacroConditionFactory::CreateWidget(const int id, QWidget *parent,
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
std::string MacroConditionFactory::GetConditionName(int id)
|
||||
{
|
||||
if (auto it = _methods.find(id); it != _methods.end()) {
|
||||
return it->second._name;
|
||||
}
|
||||
return "unknown condition";
|
||||
}
|
||||
|
||||
static inline void populateLogicSelection(QComboBox *list, bool root = false)
|
||||
{
|
||||
if (root) {
|
||||
|
||||
@@ -55,8 +55,13 @@ bool Macro::CeckMatch()
|
||||
_name.c_str());
|
||||
break;
|
||||
}
|
||||
vblog(LOG_INFO, "condition %s returned %d",
|
||||
MacroConditionFactory::GetConditionName(c->GetId())
|
||||
.c_str(),
|
||||
cond);
|
||||
}
|
||||
|
||||
vblog(LOG_INFO, "Macro %s returned %d", _name.c_str(), _matched);
|
||||
return _matched;
|
||||
}
|
||||
|
||||
@@ -232,7 +237,8 @@ bool MacroAction::Load(obs_data_t *obj)
|
||||
|
||||
void MacroAction::LogAction()
|
||||
{
|
||||
blog(LOG_INFO, "performed action %d", GetId());
|
||||
vblog(LOG_INFO, "performed action %s",
|
||||
MacroActionFactory::GetActionName(GetId()).c_str());
|
||||
}
|
||||
|
||||
void SwitcherData::saveMacros(obs_data_t *obj)
|
||||
|
||||
Reference in New Issue
Block a user