Skip to content

Replace internal logger with zap library #383

@dmjb

Description

@dmjb

Currently we use a singleton logger, and our own interface around it. We have a number of issues with this approach, including the fact that our interface does not cover all the necessary functionality of the logging libraries underneath it.

Based on internal discussion, we have identified uber-go/zap as the best fit. We should remove our internal logging interface and replace all usages with direct calls to zap. We have some specific requirements around the logging as well:

  1. We need the ability to support structured logging (for the server and k8s deployment cases) and human-readable logging for the CLI. Zap provides support for both (see the sugared logger for the pretty printed output). We should have the ability to switch between them as needed without any of the application code needing to know about the differences.
  2. Instead of using a global singleton logger, we should instantiate a logger per component or per function (whichever is cleaner).
  3. We should have a clean way of specifying the log level to be used in the application. Preferably, if the --debug global flag is passed to the CLI, we should raise the log level to debug.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions