-
Notifications
You must be signed in to change notification settings - Fork 2
[K9VULN-6211] Add context to logs #226
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
Conversation
e3fe057
to
405a4cd
Compare
Refs: K9VULN-6211
Refs: K9VULN-6211
Refs: K9VULN-6211
Also decided to make te output prettier Corrected a log to make it have an actual level Refs: K9VULN-6211
also added missing parameter to some test Refs: K9VULN-7714
af016c8
to
abe41ed
Compare
Refs: K9VULN-6211
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.
small comments. Overall if it works then it should be a big help!
pkg/printer/printer.go
Outdated
for index := range summary.Queries { | ||
idx := len(summary.Queries) - index - 1 | ||
if summary.Queries[idx].Severity == model.SeverityTrace { | ||
continue | ||
} | ||
|
||
fmt.Printf( | ||
(&logger).Info().Msgf( |
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.
unless I'm missing something, I don't think you need to grab a pointer to use the logger
pkg/printer/printer.go
Outdated
@@ -167,13 +169,13 @@ func PrintResult(summary *model.Summary, printer *Printer, usingCustomQueries bo | |||
return nil | |||
} | |||
|
|||
func printSeverityCounter(severity string, counter int, printColor color.RGBColor) { | |||
fmt.Printf("%s: %d\n", printColor.Sprint(severity), counter) | |||
func printSeverityCounter(severity string, counter int, logger *zerolog.Logger) { |
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.
generally it's fine to just grab the logger again, instead of passing it along
Refs: K9VULN-6211
Refs: K9VULN-6211
This way, we will use the same logger Refs: K9VULN-6211
refs: K9VULN-6211
…eters Refs: K9VULN-6211
056878d
to
2e3d1d7
Compare
…lure Refs: K9VULN-6211
Reason for Proposed Changes
Proposed Changes
Currently, the logs have only the message attached to them for the developers to gather informations on what is happening.
The change here is to add some "context" to those logs. This means that attached to the logs, there will be not only the message but also the repository, the branch and the commit sha, also the org and the org_id.
Here are some logs with the new infos on them: https://dd.datad0g.com/logs/livetail?query=service%3Aiac-scanning&refresh_mode=paused&storage=driveline&from_ts=1756208553000&to_ts=1756209453000&live=false
I submit this contribution under the Apache-2.0 license.