logger

package
v0.1.11 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Debug

func Debug(msg string, fields Fields)

Debug logs a message at level Debug with fields.

func Debugf

func Debugf(format string, args ...interface{})

Debugf logs a message at level Debug on the standard logger.

func DebugfContext added in v0.1.11

func DebugfContext(ctx context.Context, format string, args ...interface{})

DebugfContext logs a message at level Debug with the given context (trace_id/correlation_id from ctx are included in JSON).

func Error

func Error(msg string, fields Fields)

Error logs a message at level Error with fields.

func Errorf

func Errorf(format string, args ...interface{})

Errorf logs a message at level Error on the standard logger.

func ErrorfContext added in v0.1.11

func ErrorfContext(ctx context.Context, format string, args ...interface{})

ErrorfContext logs a message at level Error with the given context (trace_id/correlation_id from ctx are included in JSON).

func Fatalf

func Fatalf(format string, args ...interface{})

Fatalf logs a message at level Fatal on the standard logger and exits.

func GetCorrelationID added in v0.1.11

func GetCorrelationID(ctx context.Context) string

GetCorrelationID returns the correlation ID from ctx if set, otherwise empty string.

func GetLogger

func GetLogger() *slog.Logger

GetLogger returns the underlying slog.Logger instance

func GetTraceID added in v0.1.11

func GetTraceID(ctx context.Context) string

GetTraceID returns the trace ID from ctx if set, otherwise empty string.

func Info

func Info(msg string, fields Fields)

Info logs a message at level Info with fields.

func Infof

func Infof(format string, args ...interface{})

Infof logs a message at level Info on the standard logger.

func InfofContext added in v0.1.11

func InfofContext(ctx context.Context, format string, args ...interface{})

InfofContext logs a message at level Info with the given context (trace_id/correlation_id from ctx are included in JSON).

func SetLogLevel

func SetLogLevel(level slog.Level)

SetLogLevel sets the log level for the logger

func Warn

func Warn(msg string, fields Fields)

Warn logs a message at level Warn with fields.

func Warnf

func Warnf(format string, args ...interface{})

Warnf logs a message at level Warn on the standard logger.

func WarnfContext added in v0.1.11

func WarnfContext(ctx context.Context, format string, args ...interface{})

WarnfContext logs a message at level Warn with the given context (trace_id/correlation_id from ctx are included in JSON).

func WithCorrelationID added in v0.1.11

func WithCorrelationID(ctx context.Context, correlationID string) context.Context

WithCorrelationID returns a copy of ctx with the given correlation ID.

func WithTraceID added in v0.1.11

func WithTraceID(ctx context.Context, traceID string) context.Context

WithTraceID returns a copy of ctx with the given trace ID.

Types

type Fields

type Fields map[string]interface{}

Fields is a map of key-value pairs for structured logging

Jump to

Keyboard shortcuts

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