logging

package
v2.0.0-alpha.1 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2025 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Level

type Level int

Level represents a logging level

const (
	Verbo Level = iota - 2
	Trace
	Debug
	Info
	Warn
	Error
	Fatal
	Off
)

func ToLevel

func ToLevel(s string) (Level, error)

ToLevel converts a string to a Level

func (Level) LowerString

func (l Level) LowerString() string

LowerString returns the lowercase string representation of the level

func (Level) String

func (l Level) String() string

String returns the string representation of the level

type Logger

type Logger interface {
	// Debug logs at debug level
	Debug(msg string, args ...interface{})

	// Info logs at info level
	Info(msg string, args ...interface{})

	// Warn logs at warn level
	Warn(msg string, args ...interface{})

	// Error logs at error level
	Error(msg string, args ...interface{})

	// Fatal logs at fatal level and exits
	Fatal(msg string, args ...interface{})

	// With returns a logger with additional context
	With(args ...interface{}) Logger

	// WithContext returns a logger with additional context
	WithContext(key string, value interface{}) Logger
}

Logger defines the logging interface

func NewLogger

func NewLogger(name string) Logger

NewLogger creates a new logger

func NewLoggerWithOutput

func NewLoggerWithOutput(name string, w io.Writer) Logger

NewLoggerWithOutput creates a new logger with custom output

type NoLog

type NoLog struct{}

NoLog is a logger that doesn't log anything

func (NoLog) Debug

func (NoLog) Debug(string, ...interface{})

Debug implements Logger

func (NoLog) Error

func (NoLog) Error(string, ...interface{})

Error implements Logger

func (NoLog) Fatal

func (NoLog) Fatal(string, ...interface{})

Fatal implements Logger

func (NoLog) Info

func (NoLog) Info(string, ...interface{})

Info implements Logger

func (NoLog) Warn

func (NoLog) Warn(string, ...interface{})

Warn implements Logger

func (NoLog) With

func (n NoLog) With(...interface{}) Logger

With implements Logger

func (NoLog) WithContext

func (n NoLog) WithContext(string, interface{}) Logger

WithContext implements Logger

Jump to

Keyboard shortcuts

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