Skip to the content.

10. logger format

Date: 2022-12-21

Status

Accepted

Context

We use logging to track the performance of our services. We want to develop a standard approach for logging all of our services.

Decision

We selected JSON format for logging. We will use the following format:

{
  "level": "info",
  "msg": "message",
  "timestamp": "2006-01-02T15:04:05.999999999Z07:00",
  "caller": "main.go:42",
  "trace_id": "trace_id"
}

Application logs

To record application logs, use span events. You must set the event name to log and use semantic attributes to record the context:

Consequences

We use next material for made our logger format: