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

fix(logs) logs should not color words with the ERR substring #1350

Merged
merged 6 commits into from
Sep 2, 2020

Conversation

corykitchens
Copy link
Contributor

Addresses #1312

Removes the element ERR from the fatalCodes slice

This ensures that any Event struct containing the substring "ERR" will no longer be color-coded.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Copy link
Contributor

@iamhopaul123 iamhopaul123 left a comment

Choose a reason for hiding this comment

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

Thanks for contributing! I believe this can fix the issue for now but in the long run we might still have similar problems if there's any keyword containing "fatal" or something else that will be colored unexpectedly. Would you mind taking a different route like preventing any keyword with substring fatalCodes to be colored?

Copy link
Contributor

@iamhopaul123 iamhopaul123 left a comment

Choose a reason for hiding this comment

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

This is awesome! Thank you so much for contributing!

@iamhopaul123 iamhopaul123 self-requested a review September 2, 2020 19:53
words := strings.Split(message, " ")
for i, word := range words {
if word == code {
words[i] = givenColor.Sprint(word)
Copy link
Contributor

Choose a reason for hiding this comment

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

Btw, looks like this ERR: .... error message could not be shown with ERR to be in red right?

Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder if we can make use of regex to do this matching stuff https://play.golang.org/p/uPTVbBXzXFz

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Awesome thanks for all the feedback @iamhopaul123 and including a snippet of the regex!

Copy link
Contributor

@iamhopaul123 iamhopaul123 left a comment

Choose a reason for hiding this comment

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

Awesome! LGTM :shipit:

Copy link
Contributor

@efekarakus efekarakus left a comment

Choose a reason for hiding this comment

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

awesome, thank you!

@mergify mergify bot merged commit 52ce3ff into aws:mainline Sep 2, 2020
thrau pushed a commit to localstack/copilot-cli-local that referenced this pull request Dec 9, 2022
Addresses aws#1312 

Removes the element `ERR` from the `fatalCodes` slice

This ensures that any Event struct containing the substring "ERR" will no longer be color-coded. 


By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
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.

3 participants