Documentation ¶
Overview ¶
Package log provides utilities for logging messages to various outputs.
Index ¶
- Constants
- type Backend
- type Level
- type Logger
- func (l *Logger) Alert(msg string, args ...any)
- func (l *Logger) Critical(msg string, args ...any)
- func (l *Logger) Debug(msg string, args ...any)
- func (l *Logger) Error(msg string, args ...any)
- func (l *Logger) Fatal(msg string, args ...any)
- func (l *Logger) Info(msg string, args ...any)
- func (l *Logger) Notice(msg string, args ...any)
- func (l *Logger) Trace(msg string, args ...any)
- func (l *Logger) Warning(msg string, args ...any)
Constants ¶
const ( Stdout = "stdout" Stderr = "stderr" Discard = "discard" Syslog = "syslog" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Backend ¶
type Backend struct {
// contains filtered or unexported fields
}
func NewBackend ¶
NewBackend initializes the logging backend according to the given configuration. If the backend cannot be accessed, an error is returned.
Level represents the minimum logging priority accepted by the backend. Any message with a lower priority will be discarded.
LogTo is the logging output. It can be either: - Stdout - Stderr - Discard - Syslog - a file name
Facility and Tag are only used with a Syslog output. They represent respectively the logging facility and the application's name (in the logging facility).
func (*Backend) ChangeLevel ¶
type Level ¶
type Level uint8
Level represents a logging level. Available levels are: - LevelDebug - LevelInfo - LevelWarning - LevelError - LevelCritical.
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
Logger is an internal abstraction of the underlying logging library.
func (*Logger) Critical ¶
Critical outputs a log message at the "critical" (LevelCritical) priority.
func (*Logger) Fatal ¶
Fatal outputs a log message at the "fatal" (LevelFatal) priority, and immediately exits the program afterwards.