Help us shape the future of Go! Take the 2026 Go Developer Survey

logger

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LogLevel

type LogLevel int

LogLevel defines log severity levels

const (
	// Log levels from least to most restrictive
	LevelDebug LogLevel = iota
	LevelInfo
	LevelWarn
	LevelError
	LevelNone
)

type Logger

type Logger struct {
	VerboseMode bool // Legacy flag, maps to Debug level
	// contains filtered or unexported fields
}

Logger provides structured logging with levels

func New

func New(out io.Writer, verbose bool, useColors bool) *Logger

New creates a new Logger with the given settings. Normal CLI operation is warning-oriented; verbose mode enables debug and info diagnostics. Callers can explicitly request info with SetLevel("info").

func (*Logger) Debug

func (l *Logger) Debug(format string, args ...interface{})

Debug logs a debug message if verbose mode is enabled

func (*Logger) Error

func (l *Logger) Error(format string, args ...interface{})

Error logs an error message

func (*Logger) Info

func (l *Logger) Info(format string, args ...interface{})

Info logs an informational message (standard level)

func (*Logger) SetLevel

func (l *Logger) SetLevel(levelStr string)

SetLevel sets the log level

func (*Logger) Warn

func (l *Logger) Warn(format string, args ...interface{})

Warn logs a warning message

func (*Logger) WithLevel

func (l *Logger) WithLevel(level LogLevel) *Logger

WithLevel sets the log level and returns the logger

Jump to

Keyboard shortcuts

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