logger

package
v0.0.0-...-422e9ff Latest Latest
Warning

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

Go to latest
Published: May 12, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package logger defines a common logging interface and provides implementations for various logging libraries.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Logger

type Logger interface {
	// Errorf logs a message at the error level.
	Errorf(format string, args ...interface{})
	// Fatalf logs a message at the fatal level and calls os.Exit(1).
	Fatalf(format string, args ...interface{})
	// Fatal logs a message at the fatal level and calls os.Exit(1).
	Fatal(args ...interface{})
	// Infof logs a message at the info level.
	Infof(format string, args ...interface{})
	// Info logs a message at the info level.
	Info(args ...interface{})
	// Warnf logs a message at the warn level.
	Warnf(format string, args ...interface{})
	// Debugf logs a message at the debug level.
	Debugf(format string, args ...interface{})
	// Debug logs a message at the debug level.
	Debug(args ...interface{})
}

Logger is an interface for logging.

type Nop

type Nop struct{}

Nop is a logger that does nothing.

func NewNop

func NewNop() Nop

NewNop creates a new Nop.

func (Nop) Debug

func (Nop) Debug(_ ...interface{})

Debug logs a message at the debug level.

func (Nop) Debugf

func (Nop) Debugf(_ string, _ ...interface{})

Debugf logs a message at the debug level.

func (Nop) Errorf

func (Nop) Errorf(_ string, _ ...interface{})

Errorf logs a message at the error level.

func (Nop) Fatal

func (Nop) Fatal(_ ...interface{})

Fatal logs a message at the fatal level and calls os.Exit(1).

func (Nop) Fatalf

func (Nop) Fatalf(_ string, _ ...interface{})

Fatalf logs a message at the fatal level and calls os.Exit(1).

func (Nop) Info

func (Nop) Info(_ ...interface{})

Info logs a message at the info level.

func (Nop) Infof

func (Nop) Infof(_ string, _ ...interface{})

Infof logs a message at the info level.

func (Nop) Warnf

func (Nop) Warnf(_ string, _ ...interface{})

Warnf logs a message at the warn level.

type Slog

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

Slog is a logger that uses the standard library's log/slog package.

func NewSlog

func NewSlog() *Slog

NewSlog creates a new Slog.

func (*Slog) Debug

func (s *Slog) Debug(args ...interface{})

Debug logs a message at the debug level.

func (*Slog) Debugf

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

Debugf logs a message at the debug level.

func (*Slog) Errorf

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

Errorf logs a message at the error level.

func (*Slog) Fatal

func (s *Slog) Fatal(args ...interface{})

Fatal logs a message at the fatal level and calls os.Exit(1).

func (*Slog) Fatalf

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

Fatalf logs a message at the fatal level and calls os.Exit(1).

func (*Slog) Info

func (s *Slog) Info(args ...interface{})

Info logs a message at the info level.

func (*Slog) Infof

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

Infof logs a message at the info level.

func (*Slog) Warnf

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

Warnf logs a message at the warn level.

func (*Slog) WithContext

func (s *Slog) WithContext(_ context.Context) *Slog

WithContext returns a logger that is bound to a specific context. Currently it just returns the same logger since we don't have context-specific fields yet.

type Zerolog

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

Zerolog is a logger that uses the zerolog package.

func NewZerolog

func NewZerolog(l zerolog.Logger) *Zerolog

NewZerolog creates a new Zerolog.

func (*Zerolog) Debug

func (z *Zerolog) Debug(args ...interface{})

Debug logs a message at the debug level.

func (*Zerolog) Debugf

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

Debugf logs a message at the debug level.

func (*Zerolog) Errorf

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

Errorf logs a message at the error level.

func (*Zerolog) Fatal

func (z *Zerolog) Fatal(args ...interface{})

Fatal logs a message at the fatal level and calls os.Exit(1).

func (*Zerolog) Fatalf

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

Fatalf logs a message at the fatal level and calls os.Exit(1).

func (*Zerolog) Info

func (z *Zerolog) Info(args ...interface{})

Info logs a message at the info level.

func (*Zerolog) Infof

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

Infof logs a message at the info level.

func (*Zerolog) Warnf

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

Warnf logs a message at the warn level.

Jump to

Keyboard shortcuts

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