log

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultLogger = New(false)

Functions

func Setup

func Setup(verbose bool)

Setup configures the DefaultLogger with the given verbosity without reassigning the global logger instance.

func WithLogger

func WithLogger(ctx context.Context, logger *Logger) context.Context

WithLogger returns a new context carrying the given logger.

Types

type Logger

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

Logger provides context-aware leveled logging.

func FromContext

func FromContext(ctx context.Context) *Logger

FromContext retrieves the logger stored in ctx, or returns DefaultLogger.

func New

func New(verbose bool) *Logger

New creates a new Logger writing to stdout.

func (*Logger) Debugf

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

Debugf logs a debug-level message when verbose mode is enabled.

func (*Logger) Errorf

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

Errorf logs an error-level message.

func (*Logger) Infof

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

Infof logs an info-level message when verbose mode is enabled.

func (*Logger) Printf added in v1.3.0

func (l *Logger) Printf(format string, args ...any)

Printf writes a formatted string to output. A newline is appended if the formatted string does not end with one.

func (*Logger) Println added in v1.3.0

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

Println writes args to output followed by a newline.

func (*Logger) Success

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

Success logs a success message.

func (*Logger) Verbosef

func (l *Logger) Verbosef(format string, args ...any)

Verbosef logs a formatted message when verbose mode is enabled.

func (*Logger) Verboseln

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

Verboseln logs a line when verbose mode is enabled.

func (*Logger) Warnf

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

Warnf logs a warning-level message.

Jump to

Keyboard shortcuts

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