Skip to content

Use a structure zero copy logger like zerolog or zap #108

Open

Description

@butonic

https://github.com/op/go-logging has dated a little. to reduce logging overhead we should switch to a zero copy logger like https://github.com/rs/zerolog or https://github.com/uber-go/zap.

Not only will they reduce the number of memory allocations but they will also introduce structured logging, which makes debugging and correlating requests with eg. an elk stack so much more pleasant.

In order to let others inject a logger of their choice we should use a common logger api, see #107

Activity

  1. added this to the v2.0.0 milestone on Feb 25, 2020
  2. changed the title [-]Use a zero copy logger like zerolog[/-] [+]Use a structure zero copy logger like zerolog or zap[/+] on Feb 26, 2020
  3. infogulch commented on Aug 22, 2023

    @infogulch

    Go 1.21 released with the log/slog package:

    New log/slog package

    The new log/slog package provides structured logging with levels. Structured logging emits key-value pairs to enable fast, accurate processing of large amounts of log data. The package supports integration with popular log analysis tools and services.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions