-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Custom Log Formatting #3537
Custom Log Formatting #3537
Conversation
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.
Requesting changes early.
I've only reviewed the docs stuff, but they look really good. There's so much detail, and the examples really help explain what's going on.
Great job!
Co-authored-by: Yousif Akbar <[email protected]>
options/options.go
Outdated
@@ -128,7 +129,7 @@ type TerragruntOptions struct { | |||
// Disable Terragrunt colors | |||
DisableLogColors bool | |||
|
|||
// Output Terragrunt logs in JSON format | |||
// Output Terragrunt logs in JSON formatter |
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.
Format was right here. Is this an accidental find and replace?
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.
Oh yeah, that was by accident when I made a replacement throughout the code.
} | ||
} | ||
|
||
func (color *gradientColor) Value(text string) ColorValue { |
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.
I'm not following how this is implemented, but probably just because I'm bad at golang.
Can you confirm that this will result in color transitioning from one color to another, like this?
https://upload.wikimedia.org/wikipedia/commons/thumb/f/fa/Linear-gradient.svg/640px-Linear-gradient.svg.png
Do not implement this now, but I wonder if in the future we could have a user specify what the start and end colors would be.
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 already discussed this in a call conversation. This can works as gradient, we need just to fill the slice with gradient colors.
**Environment Variable**: `TERRAGRUNT_LOG_CUSTOM_FORMAT`<br/> | ||
**Requires an argument**: `--terragrunt-log-custom-format <LOG_CUSTOM_FORMAT>`<br/> | ||
|
||
This allows you to specify which information you want to output. It works a little bit like printf format. |
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.
This allows you to specify which information you want to output. It works a little bit like printf format. | |
This allows you to customize logging however you like. |
pkg/log/options.go
Outdated
return func(logger *logger) { | ||
logger.Logger.SetFormatter(formatter) | ||
logger.Logger.SetFormatter(&logruFormatter{Formatter: formatter}) |
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.
I'm confused by this. Why is this called logruFormatter
?
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.
This is a typo. Fixed and added a comment.
Resolved in v0.68.15 release. |
Description
The PR adds two flags:
--terragrunt-log-format [bare | pretty | json | keyvalue]
--terragrunt-log-custom-format "%time %level %prefix %msg"
Context
https://linear.app/gruntwork/issue/TG-419/support-deep-log-format-customization
Closes #3431
TODOs
Read the Gruntwork contribution guidelines.
Release Notes (draft)
Added / Removed / Updated [X].
Migration Guide