Documentation
¶
Overview ¶
Package logger provides logging functionality for StreamSQL. Supports different log levels and configurable log output backends.
Index ¶
- func Debug(format string, args ...any)
- func DebugFields(msg string, fields ...Field)
- func Error(format string, args ...any)
- func ErrorFields(msg string, fields ...Field)
- func Info(format string, args ...any)
- func InfoFields(msg string, fields ...Field)
- func SetDefault(logger Logger)
- func Warn(format string, args ...any)
- func WarnFields(msg string, fields ...Field)
- type Field
- type Format
- type Level
- type Logger
- type StructuredLogger
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DebugFields ¶ added in v1.0.0
func ErrorFields ¶ added in v1.0.0
func InfoFields ¶ added in v1.0.0
InfoFields emits a structured INFO entry on the default logger. If the default does not implement StructuredLogger (a custom printf-only logger), the fields are folded into a single text message so no context is lost.
func WarnFields ¶ added in v1.0.0
Types ¶
type Field ¶ added in v1.0.0
Field is a structured key-value pair attached to a log entry.
func Any ¶ added in v1.0.0
Any captures an arbitrary value under k. Prefer a typed constructor when one exists; Any defers formatting to the renderer.
func Duration ¶ added in v1.0.0
Duration records a duration as its human-readable string form (e.g. "12ms").
type Format ¶ added in v1.0.0
type Format int
Format selects the encoding of structured log entries.
type Logger ¶
type Logger interface {
// Debug records debug level logs
Debug(format string, args ...any)
// Info records info level logs
Info(format string, args ...any)
// Warn records warning level logs
Warn(format string, args ...any)
// Error records error level logs
Error(format string, args ...any)
// SetLevel sets the log level
SetLevel(level Level)
}
Logger interface defines basic methods for logging
func NewDiscardLogger ¶
func NewDiscardLogger() Logger
NewDiscardLogger creates a logger that discards all logs Used in scenarios where log output is not needed
type StructuredLogger ¶ added in v1.0.0
type StructuredLogger interface {
DebugFields(msg string, fields ...Field)
InfoFields(msg string, fields ...Field)
WarnFields(msg string, fields ...Field)
ErrorFields(msg string, fields ...Field)
}
StructuredLogger is the optional structured variant of Logger. Loggers that implement it emit key-value context; the printf-style Logger methods remain available alongside. Package-level helpers (InfoFields, ...) use this when present and otherwise fall back to the printf method.