log

package
v0.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2024 License: UNKNOWN not legal advice Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewZapConsoleLogger

func NewZapConsoleLogger(w io.Writer, level zapcore.Level, opts ...zap.Option) *zap.Logger

NewZapConsoleLogger creates a zap logger with a console encoder for development use.

func NewZapJSONLogger

func NewZapJSONLogger(w io.Writer, level zapcore.Level, opts ...zap.Option) *zap.Logger

NewZapJSONLogger creates a zap logger with a JSON encoder for production use.

func NewZapLogger

func NewZapLogger(enc zapcore.Encoder, w io.Writer, level zapcore.Level, opts ...zap.Option) *zap.Logger

NewZapLogger creates a new zap logger instance, for the given level, writer and zap encoder.

func NewZapTestingLogger

func NewZapTestingLogger(w io.Writer, level zapcore.Level, opts ...zap.Option) *zap.Logger

NewZapTestingLogger creates a zap logger with a console encoder optimized for testing.

func ZapLoggerToSlog

func ZapLoggerToSlog(logger *zap.Logger) *slog.Logger

ZapLoggerToSlog wraps the given zap logger to an log/slog Logger

Types

type Format

type Format string

Format is the log format

const (
	JSONFormat    Format = "json"
	ConsoleFormat Format = "console"
	TestingFormat Format = "testing"
)

func (Format) String

func (f Format) String() string

type NewZapLoggerFn

type NewZapLoggerFn func(w io.Writer, level zapcore.Level, opts ...zap.Option) *zap.Logger

NewZapLoggerFn is the zap logger init declaration

func GetZapLoggerFn

func GetZapLoggerFn(format Format) NewZapLoggerFn

GetZapLoggerFn returns the appropriate init callback for the zap logger, given the requested format

Jump to

Keyboard shortcuts

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