logging

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2026 License: MPL-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var PanicChannel chan PanicPayload

Functions

func Debug

func Debug(v ...interface{})

Debug logs a debug message using the default logger.

func Debugf

func Debugf(format string, v ...interface{})

Debugf logs a formatted debug message using the default logger.

func Error

func Error(v ...interface{})

Error logs an error message using the default logger.

func Errorf

func Errorf(format string, v ...interface{})

Errorf logs a formatted error message using the default logger.

func HandlePanic added in v1.1.0

func HandlePanic()

func Info

func Info(v ...interface{})

Info logs an informational message using the default logger.

func Infof

func Infof(format string, v ...interface{})

Infof logs a formatted informational message using the default logger.

func IsDebugEnabled

func IsDebugEnabled() bool

func SetDefault

func SetDefault(logger *Logger)

SetDefault replaces the default logger instance.

func Warn

func Warn(v ...interface{})

Warn logs a warning message using the default logger.

func Warnf

func Warnf(format string, v ...interface{})

Warnf logs a formatted warning message using the default logger.

Types

type LogEntry

type LogEntry struct {
	Timestamp time.Time
	Level     LogLevel
	Message   string
}

LogEntry represents a single, structured log message.

type LogLevel

type LogLevel int

LogLevel defines the severity of a log entry.

const (
	LevelDebug LogLevel = iota
	LevelInfo
	LevelWarn
	LevelError
)

Enum for log levels. The order is important for filtering.

func (LogLevel) String

func (l LogLevel) String() string

String returns the string representation of a LogLevel.

type LogStore

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

LogStore holds all log entries in memory for the UI. It is thread-safe.

func (*LogStore) Add

func (s *LogStore) Add(entry LogEntry)

Add appends a new entry to the store.

func (*LogStore) GetAll

func (s *LogStore) GetAll() []LogEntry

GetAll returns a copy of all log entries.

type Logger

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

Logger is a central logger that writes to a store and an optional io.Writer.

func NewLogger

func NewLogger() *Logger

NewLogger creates and initializes a new Logger instance.

func (*Logger) Debug

func (l *Logger) Debug(v ...interface{})

Debug logs a debug message.

func (*Logger) Debugf

func (l *Logger) Debugf(format string, v ...interface{})

Debugf logs a formatted debug message.

func (*Logger) Error

func (l *Logger) Error(v ...interface{})

Error logs an error message.

func (*Logger) Errorf

func (l *Logger) Errorf(format string, v ...interface{})

Errorf logs a formatted error message.

func (*Logger) GetWriter

func (l *Logger) GetWriter() io.Writer

GetWriter returns the current output writer.

func (*Logger) Info

func (l *Logger) Info(v ...interface{})

Info logs an informational message.

func (*Logger) Infof

func (l *Logger) Infof(format string, v ...interface{})

Infof logs a formatted informational message.

func (*Logger) IsDebugEnabled

func (l *Logger) IsDebugEnabled() bool

func (*Logger) SetDebug

func (l *Logger) SetDebug(enable bool)

SetDebug enables or disables debug-level logging.

func (*Logger) SetWriter

func (l *Logger) SetWriter(w io.Writer)

SetWriter sets the output destination for the logger.

func (*Logger) Store

func (l *Logger) Store() *LogStore

Store returns the internal LogStore.

func (*Logger) Warn

func (l *Logger) Warn(v ...interface{})

Warn logs a warning message.

func (*Logger) Warnf

func (l *Logger) Warnf(format string, v ...interface{})

Warnf logs a formatted warning message.

func (*Logger) Write

func (l *Logger) Write(p []byte) (n int, err error)

Write implements the io.Writer interface. This allows the standard log package to write through our logger, which will then dispatch to the configured writer.

type PanicPayload added in v1.1.0

type PanicPayload struct {
	Value interface{}
	Stack []byte
}

Jump to

Keyboard shortcuts

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