zlog/cmd/prettylog
a f380226321 update? 2022-12-28 03:33:41 -06:00
..
README.md CLI utility to pipe JSON logs through to pretty print and colorize them (#449) 2022-09-03 04:06:22 -07:00
prettylog.go update? 2022-12-28 03:33:41 -06:00

README.md

Zerolog PrettyLog

This is a basic CLI utility that will colorize and pretty print your structured JSON logs.

Usage

You can compile it or run it directly. The only issue is that by default Zerolog does not output to stdout but rather to stderr so we must pipe stderr stream to this CLI tool.

Linux

These commands will redirect stderr to our prettylog tool and stdout will remain unaffected.

  1. Compiled version
some_program_with_zerolog 2> >(prettylog)
  1. Run it directly with go run
some_program_with_zerolog 2> >(go run cmd/prettylog/prettylog.go)

Windows

These commands will redirect stderr to stdout and then pipe it to our prettylog tool.

  1. Compiled version
some_program_with_zerolog 2>&1 | prettylog
  1. Run it directly with go run
some_program_with_zerolog 2>&1 | go run cmd/prettylog/prettylog.go