logger

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2023 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package logger implements an interface behind which a third party, levelled logger can sit. This abstraction allows us to readily swap out the logger used and to pass it down throughout the spok program without changing the logger being a massive task.

Spok's logging needs are fairly basic, it really only needs DEBUG level logs for the --verbose flag.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Logger

type Logger interface {
	// Sync flushes the logs to stderr
	Sync() error
	// Debug outputs a debug level log line
	Debug(format string, args ...any)
}

Logger is the interface behind which a debug logger can sit.

type ZapLogger

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

ZapLogger is a Logger that uses zap under the hood.

func NewZapLogger

func NewZapLogger(verbose bool) (*ZapLogger, error)

NewZapLogger builds and returns a ZapLogger.

func (*ZapLogger) Debug

func (z *ZapLogger) Debug(format string, args ...any)

Debug outputs a debug level log line, a newline is automatically added.

func (*ZapLogger) Sync

func (z *ZapLogger) Sync() error

Sync flushes the logs.

Jump to

Keyboard shortcuts

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