Skip to content

Log format

A log format is a string that can be used to format log messages. The default log format is json.

Two formats are available :

  • json
  • human

JSON format

Output

{"level": "info","time": "2022-01-01T14:00:00+00:00","caller": "demo.go:17","message": "hello world"}

Setup

1
2
3
    zr.Setup(
        zr.WithCustomFormat(zr.LevelJSON()), // (1)
    )
  1. This is a default value

Human format

Output

2022-01-01T14:00:00+00:00 INF demo.go:17 > hello world

Setup

1
2
3
    zr.Setup(
        zr.WithCustomFormat(zr.LevelHuman()), 
    )