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

add Quote type to enable safe concise output of untrusted strings #96

Merged
merged 1 commit into from Jul 7, 2021

Conversation

schmichael
Copy link
Member

@schmichael schmichael commented Jul 6, 2021

Output from hashicorp/nomad#10858 using hclog v0.14.1 (double double quotes):

2021-07-06T10:06:01.590-0700 [WARN] ... task=redis health=critical output=""This is the output for state 2\n""

Output using hclog v0.16.1 (breaks naive 1-line-per-log parsers):

2021-07-06T15:41:34.112-0700 [WARN] ... task=redis health=warning
  output=
  | This is the output for state 1

Output using this PR:

2021-07-06T15:42:28.192-0700 [WARN] ... task=redis health=warning output="This is the output for state 1\n"

@schmichael schmichael requested a review from evanphx July 6, 2021 22:14
@schmichael schmichael marked this pull request as ready for review July 6, 2021 22:52
@schmichael
Copy link
Member Author

Left open for a while to consider other names. Almost went with Escape like in Javascript, but Javascript's escape uses %NN notation instead of \x notation like Go's strconv.Quote and JSON. Keeping the Quote name and merging.

@schmichael schmichael merged commit 480ace9 into master Jul 7, 2021
@schmichael schmichael deleted the f-quote branch July 7, 2021 17:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants