Skip to content
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

docs(website): fix incorrect example about the contains function #22499

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions website/content/en/guides/level-up/transformation.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,8 @@ transforms:
# If the log message contains the phrase "Great Scott!", set the new field
# "critical" to true, otherwise set it to false. If the "contains" function
# errors, log the error (instead of aborting the script, as above).
if (is_critical, err = contains(.message, "Great Scott!"); err != null) {
log(err, level: "error")
if (is_critical = contains(.message, "Great Scott!"); is_critical) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, took another look. This is still a fallible assignment per: playground

What we want instead is:

is_critical = contains(string!(.message), "Great Scott!")

log("It contains 'Great Scott!'", level: "info")
}
.critical = is_critical
Expand Down