logging

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultLogger

func DefaultLogger() *zap.SugaredLogger

DefaultLogger returns the default logger for the package.

func FromContext

func FromContext(ctx context.Context) *zap.SugaredLogger

FromContext returns the logger stored in the context. If no such logger exists, a default logger is returned.

func NewLogger

func NewLogger(conf *Config) *zap.SugaredLogger

NewLogger creates a new logger with the given log level

func SetConfig

func SetConfig(c *Config)

SetConfig sets given logging configs for DefaultLogger's logger. Must set configs before calling DefaultLogger()

func SetLevel

func SetLevel(l zapcore.Level)

func WithLogger

func WithLogger(ctx context.Context, logger *zap.SugaredLogger) context.Context

WithLogger creates a new context with the provided logger attached.

Types

type Config

type Config struct {
	Encoding    string
	Level       zapcore.Level
	Development bool
}

Jump to

Keyboard shortcuts

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