slog

package
v0.11.4 Latest Latest
Warning

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

Go to latest
Published: May 9, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// standard levels
	LevelDebug = slog.LevelDebug
	LevelInfo  = slog.LevelInfo
	LevelWarn  = slog.LevelWarn
	LevelError = slog.LevelError

	// LevelExtraDebug is between Debug and Trace. It had extra information that's useful sometimes
	// but not as overwhelming as Trace. e.g. OTEL logging is at this level.
	LevelExtraDebug = slog.LevelDebug - 1

	// Trace is the most verbose level. It includes session logging and an enormous amount of detail from
	// buildkit on cache refs and cache queries.
	LevelTrace = slog.LevelDebug - 2
)

Variables

This section is empty.

Functions

func Debug

func Debug(msg string, args ...any)

func DebugContext

func DebugContext(ctx context.Context, msg string, args ...any)

func Error

func Error(msg string, args ...any)

func ErrorContext

func ErrorContext(ctx context.Context, msg string, args ...any)

func ExtraDebug

func ExtraDebug(msg string, args ...any)

func ExtraDebugContext

func ExtraDebugContext(ctx context.Context, msg string, args ...any)

func Info

func Info(msg string, args ...any)

func InfoContext

func InfoContext(ctx context.Context, msg string, args ...any)

func NewJSONHandler

func NewJSONHandler(w io.Writer, opts *slog.HandlerOptions) *slog.JSONHandler

func NewTextHandler

func NewTextHandler(w io.Writer, opts *slog.HandlerOptions) *slog.TextHandler

func SetDefault

func SetDefault(l *Logger)

func Trace

func Trace(msg string, args ...any)

func TraceContext

func TraceContext(ctx context.Context, msg string, args ...any)

func Warn

func Warn(msg string, args ...any)

func WarnContext

func WarnContext(ctx context.Context, msg string, args ...any)

Types

type Level

type Level = slog.Level

type Logger

type Logger struct {
	*slog.Logger
}

Logger wraps the slog.Logger type with support for a few additional levels

func Default

func Default() *Logger

func New

func New(h slog.Handler) *Logger

func With

func With(args ...any) *Logger

func (*Logger) ExtraDebug

func (l *Logger) ExtraDebug(msg string, args ...any)

func (*Logger) ExtraDebugContext

func (l *Logger) ExtraDebugContext(ctx context.Context, msg string, args ...any)

func (*Logger) Trace

func (l *Logger) Trace(msg string, args ...any)

func (*Logger) TraceContext

func (l *Logger) TraceContext(ctx context.Context, msg string, args ...any)

func (*Logger) With

func (l *Logger) With(args ...any) *Logger

Jump to

Keyboard shortcuts

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