-
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
refactor(misconf): use slog #7295
Conversation
Signed-off-by: nikpivkin <[email protected]>
Signed-off-by: nikpivkin <[email protected]>
Signed-off-by: nikpivkin <[email protected]>
Signed-off-by: nikpivkin <[email protected]>
Signed-off-by: nikpivkin <[email protected]>
Signed-off-by: nikpivkin <[email protected]>
Signed-off-by: nikpivkin <[email protected]>
p.logger.Debug("Added input variables from tfvars", log.Int("count", len(inputVars))) | ||
|
||
for _, varBlock := range blocks.OfType("variable") { | ||
if varBlock.GetAttribute("default") == nil { | ||
if _, ok := inputVars[varBlock.TypeLabel()]; !ok { | ||
p.logger.Warn( | ||
"Variable was not found in the environment or variable files. Evaluating may not work correctly.", | ||
log.String("variable", varBlock.TypeLabel()), | ||
) | ||
} | ||
} | ||
} |
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.
Is there a test for this?
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.
Done 1cb0263
Also changed the wording of the logs to mean missing values rather than missing variables/parameters.
opt.Debug("Found a token for the registry at %s", hostname) | ||
opt.DebugLogger.Debug("Found a token for the registry", log.String("hostname", hostname)) |
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.
It seems a little too verbose to have opt.DebugLogger.Debug
. Could we rename it better?
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.
Renamed DebugLogger
to Logger
b2cdb99
Signed-off-by: nikpivkin <[email protected]>
Signed-off-by: nikpivkin <[email protected]>
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.
lgtm!
@nikpivkin looks like we have some merge conflicts to resolve prior to merging. |
@simar7 Done |
Description
This PR improves the logging in the IaC package. The slog package is now used for logging, which aligns the logging style with Trivy.
Changes:
Small refactoring: since no options are now passed to IaC parsers, unnecessary interfaces have been removed.
Related issues
Before
After
Checklist