clorthozap

package
v0.0.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 17, 2022 License: Apache-2.0 Imports: 4 Imported by: 4

Documentation

Overview

Package clorthozap provides basic integration with go.uber.org/zap. Primarily, this is through listeners that simply log information about events.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Listener

type Listener struct {
	// contains filtered or unexported fields
}

Listener is both a clortho.RefreshListener and a clortho.ResolveListener that logs information about events via a supplied zap logger.

func NewListener

func NewListener(options ...ListenerOption) (l *Listener, err error)

NewListener constructs a *Listener that outputs to the supplied logger.

func (*Listener) OnRefreshEvent

func (l *Listener) OnRefreshEvent(event clortho.RefreshEvent)

OnRefreshEvent outputs structured logging about the event to the logger established via WithLogger when this listener was created.

func (*Listener) OnResolveEvent

func (l *Listener) OnResolveEvent(event clortho.ResolveEvent)

OnResolveEvent outputs structured logging about the event to the logger established via WithLogger when this listener was created.

type ListenerOption

type ListenerOption interface {
	// contains filtered or unexported methods
}

ListenerOption is a configurable option passed to NewListener that can tailor the created Listener.

func WithLevel

func WithLevel(level zapcore.Level) ListenerOption

WithLevel sets the log level for non-error events. By default, key refresh and resolve events are logged at INFO level.

Errors are always logged at ERROR level. Error events are not controlled by this option.

func WithLogger

func WithLogger(logger *zap.Logger) ListenerOption

WithLogger establishes the zap Logger instance that receives output. By default, a Listener will use the default logger returned by zap.L().

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL