-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add helper function print_debug
for debug purposes
#928
Conversation
v2/pkg/operators/common/dsl/dsl.go
Outdated
@@ -245,6 +245,11 @@ var functions = map[string]govaluate.ExpressionFunction{ | |||
data := deserialization.GenerateJavaGadget(gadget, cmd, encoding) | |||
return data, nil | |||
}, | |||
// for debug purposes | |||
"print_stdout": func(args ...interface{}) (interface{}, error) { | |||
fmt.Println(args) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should add a message before printing the debug values, stating they are from print_debug function. Something like this @yabeow
gologger.Info().Msgf("print_stdout debug value: ")
fmt.Println(args)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice suggestion! I've added this, please check again 👍
print_stdout
for debug purposesprint_debug
for debug purposes
lgtm! |
Hi there,
I've added an helper function called
print_debug
in DSL. This function will help to print DSL variables / outputs to stdout usingfmt.Println
function for debug purposes.Note: I've tried to use your
gologger
package but it always requires a format string so I used the standardfmt
package instead.