Documentation ¶
Overview ¶
Package cblog provides a channel based logger
Index ¶
- Constants
- type LogMsg
- type Logger
- func (l *Logger) Debug() slog.Logger
- func (*Logger) Enabled() bool
- func (l *Logger) Error() slog.Logger
- func (l *Logger) Fatal() slog.Logger
- func (l *Logger) Info() slog.Logger
- func (l *Logger) Panic() slog.Logger
- func (l *Logger) Print(args ...any)
- func (l *Logger) Printf(format string, args ...any)
- func (l *Logger) Println(args ...any)
- func (l *Logger) Warn() slog.Logger
- func (l *Logger) WithEnabled() (slog.Logger, bool)
- func (l *Logger) WithField(label string, value any) slog.Logger
- func (l *Logger) WithFields(fields map[string]any) slog.Logger
- func (l *Logger) WithLevel(level slog.LogLevel) slog.Logger
- func (l *Logger) WithStack(skip int) slog.Logger
Constants ¶
View Source
const (
// DefaultOutputBufferSize is the default size of the channel buffer used for logging.
DefaultOutputBufferSize = 1024
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Logger ¶
Logger is a slog.Logger using a channel as backend
func NewWithCallback ¶
NewWithCallback creates a logger and attached a goroutine to call a provided handler, sequentially, for each log entry
func (*Logger) Println ¶
Println adds a log entry with arguments handled in the manner of fmt.Println
func (*Logger) WithEnabled ¶
WithEnabled passes the logger and if it's enabled
func (*Logger) WithFields ¶
WithFields returns a new logger with a set of fields attached
Click to show internal directories.
Click to hide internal directories.