logger

package
v0.0.0-...-2e936b0 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	LevelDebug = Level(slog.LevelDebug)
	LevelInfo  = Level(slog.LevelInfo)
	LevelWarn  = Level(slog.LevelWarn)
	LevelError = Level(slog.LevelError)
)

Variables

This section is empty.

Functions

func NewStdLogger

func NewStdLogger(logger *Logger, level Level) *log.Logger

NewStdLogger returns a standard library Logger that wraps the slog Logger.

Types

type Level

type Level slog.Level

type Logger

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

func New

func New(w io.Writer, level Level, serviceName string, traceIDFunc TraceIDFunc) *Logger

func (*Logger) Debug

func (log *Logger) Debug(ctx context.Context, msg string, args ...any)

Debug log at DEBUG level.

func (*Logger) Error

func (log *Logger) Error(ctx context.Context, msg string, args ...any)

Error log at ERROR level.

func (*Logger) Info

func (log *Logger) Info(ctx context.Context, msg string, args ...any)

Info log at INFO level.

func (*Logger) Infoc

func (log *Logger) Infoc(ctx context.Context, caller int, msg string, args ...any)

Infoc log at INFO level with the information at the specific caller stack position.

func (*Logger) Warn

func (log *Logger) Warn(ctx context.Context, msg string, args ...any)

Warn log at WARNING level.

type TraceIDFunc

type TraceIDFunc func(ctx context.Context) string

Jump to

Keyboard shortcuts

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