ctxslog

package
v0.0.0-...-127b745 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package ctxslog wraps slog's Logger type for use in the ctxlog package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Logger

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

Logger wraps a *slog.Logger and implements the ctxlog.Logger interface.

func New

func New(debug bool, opts func(*slog.HandlerOptions)) *Logger

New creates a new logger.

func (*Logger) Debug

func (l *Logger) Debug(msg string, fields ...any)

Debug logs at the debug level.

func (*Logger) Error

func (l *Logger) Error(msg string, fields ...any)

Error logs at the error level.

func (*Logger) Fatal

func (l *Logger) Fatal(msg string, fields ...any)

Fatal logs at the fatal level. For parity with zap, this method calls os.Exit(1) after logging.

func (*Logger) Info

func (l *Logger) Info(msg string, fields ...any)

Info logs at the info level.

func (*Logger) Warn

func (l *Logger) Warn(msg string, fields ...any)

Warn logs at the warn level.

Jump to

Keyboard shortcuts

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