Skip to content

Commit

Permalink
switch all logs to stdout and prettier formatting for scan results
Browse files Browse the repository at this point in the history
  • Loading branch information
factoidforrest committed Dec 16, 2021
1 parent 70d405f commit 5b506a1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion docs/blog/2021-12-12-log4j-zero-day-mitigation-guide.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ log4shell scan your-project-dir/
log4shell.exe scan your-project-dir/
```
Because the tool contains exploit strings needed for the `livepatch` command, it might be falsely recognized as malware by some
virus scanners on Windows. Please add an exception for it.
virus scanners on Windows. Please add an exception for it.

**Example Output**
```shell
Expand Down
8 changes: 7 additions & 1 deletion tools/log4shell/commands/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,16 @@ func enableGlobalFlags(c *cli.Context) {
jsonFlag := c.Bool("json")
if !jsonFlag {
// pretty print output to the console if we are not interested in parsable output
consoleOutput := zerolog.ConsoleWriter{Out: os.Stderr}
consoleOutput := zerolog.ConsoleWriter{Out: os.Stdout}
consoleOutput.FormatFieldName = func(i interface{}) string {
return fmt.Sprintf("\n\t%s: ", util.Colorize(constants.ColorBlue, i))
}
consoleOutput.FormatLevel = func(i interface{}) string {
if (i == nil){
return util.Colorize(constants.ColorBold,"Scan Result:")
}
return fmt.Sprintf("%s",i)
}
log.Logger = log.Output(consoleOutput)

}
Expand Down

0 comments on commit 5b506a1

Please sign in to comment.