diff --git a/pkg/exprhelpers/expr_lib.go b/pkg/exprhelpers/expr_lib.go index 13e58b877..f4559157d 100644 --- a/pkg/exprhelpers/expr_lib.go +++ b/pkg/exprhelpers/expr_lib.go @@ -377,6 +377,13 @@ var exprFuncs = []exprCustomFunc{ new(func(string, string) bool), }, }, + { + name: "LogInfo", + function: LogInfo, + signature: []interface{}{ + new(func(string, ...interface{}) bool), + }, + }, } //go 1.20 "CutPrefix": strings.CutPrefix, diff --git a/pkg/exprhelpers/strings.go b/pkg/exprhelpers/strings.go index 81c6776b6..61804bcfa 100644 --- a/pkg/exprhelpers/strings.go +++ b/pkg/exprhelpers/strings.go @@ -1,6 +1,10 @@ package exprhelpers -import "strings" +import ( + "strings" + + log "github.com/sirupsen/logrus" +) //Wrappers for stdlib strings function exposed in expr @@ -67,3 +71,8 @@ func TrimSpace(params ...any) (any, error) { func TrimSuffix(params ...any) (any, error) { return strings.TrimSuffix(params[0].(string), params[1].(string)), nil } + +func LogInfo(params ...any) (any, error) { + log.Infof(params[0].(string), params[1:]...) + return true, nil +}