diff --git a/experimental/plugins/macro/macro.go b/experimental/plugins/macro/macro.go index 7f5c01cb1..7b74fe94b 100644 --- a/experimental/plugins/macro/macro.go +++ b/experimental/plugins/macro/macro.go @@ -83,7 +83,7 @@ func expandToken(tx plugintypes.TransactionState, token macroToken) string { } // If the variable is known (e.g. TX) but the key is not found, we return the original text - tx.DebugLogger().Warn().Str("variable", token.variable.Name()).Str("key", token.key).Msg("key not found in collection, returning the original text") + tx.DebugLogger().Debug().Str("variable", token.variable.Name()).Str("key", token.key).Msg("key not found in collection, returning the original text") return token.text } diff --git a/internal/actions/setvar_test.go b/internal/actions/setvar_test.go index f16e4fc9a..ab9e6fddf 100644 --- a/internal/actions/setvar_test.go +++ b/internal/actions/setvar_test.go @@ -67,6 +67,7 @@ func TestSetvarEvaluate(t *testing.T) { init2 string expectInvalidSyntaxError bool expectNewVarValue string + logLevel debuglog.Level }{ { name: "Numerical operation + with existing variable", @@ -74,6 +75,7 @@ func TestSetvarEvaluate(t *testing.T) { init2: "TX.newvar=+%{tx.var}", expectInvalidSyntaxError: false, expectNewVarValue: "5", + logLevel: debuglog.LevelError, }, { name: "Numerical operation - with existing variable", @@ -81,6 +83,7 @@ func TestSetvarEvaluate(t *testing.T) { init2: "TX.newvar=-%{tx.var}", expectInvalidSyntaxError: false, expectNewVarValue: "-5", + logLevel: debuglog.LevelError, }, { name: "Numerical operation - with existing negative variable", @@ -88,35 +91,40 @@ func TestSetvarEvaluate(t *testing.T) { init2: "TX.newvar=+5", expectInvalidSyntaxError: false, expectNewVarValue: "0", + logLevel: debuglog.LevelError, }, { name: "Numerical operation + with missing (or non-numerical) variable", init: "TX.newvar=+%{tx.missingvar}", expectInvalidSyntaxError: true, + logLevel: debuglog.LevelDebug, }, { name: "Numerical operation - with missing (or non-numerical) variable", init: "TX.newvar=-%{tx.missingvar}", expectInvalidSyntaxError: true, + logLevel: debuglog.LevelDebug, }, { name: "Non Numerical Operation - If the value starts with -", init: "TX.newvar=----expected_value", expectInvalidSyntaxError: false, expectNewVarValue: "----expected_value", + logLevel: debuglog.LevelError, }, { name: "Non Numerical Operation - If the value starts with +", init: "TX.newvar=+++expected_value", expectInvalidSyntaxError: false, expectNewVarValue: "+++expected_value", + logLevel: debuglog.LevelError, }, } for _, tt := range tests { logsBuf := &bytes.Buffer{} - logger := debuglog.Default().WithLevel(debuglog.LevelWarn).WithOutput(logsBuf) + logger := debuglog.Default().WithLevel(tt.logLevel).WithOutput(logsBuf) t.Run(tt.name, func(t *testing.T) { defer logsBuf.Reset()