Documentation ¶
Overview ¶
Package log exports logging primitives.
This package is based on upspin.io/log. Its license as well as the original code can be found in the upspin repository.
Index ¶
- Variables
- func At(level string) bool
- func Fatal(v ...any)
- func Fatalf(format string, v ...any)
- func GetLevel() string
- func NewStdLogger(l Logger) *log.Logger
- func Print(v ...any)
- func Printf(format string, v ...any)
- func Println(v ...any)
- func SetLevel(level string) error
- func SetOutput(w io.Writer)
- type Level
- type Logger
Constants ¶
This section is empty.
Variables ¶
View Source
var ( Debug = &logger{DebugLevel} Info = &logger{InfoLevel} Error = &logger{ErrorLevel} )
The set of default loggers for each log level.
Functions ¶
func NewStdLogger ¶
NewStdLogger creates a *log.Logger ("log" is from the Go standard library) that forwards messages to the provided logger using a logBridge. The standard logger is configured with log.Lshortfile, this log line format which is parsed to extract the log message (skipping the filename, line number) to forward it to the provided logger.
Types ¶
type Logger ¶
type Logger interface { // Printf writes a formated message to the log. Printf(format string, v ...any) // Print writes a message to the log. Print(v ...any) // Println writes a line to the log. Println(v ...any) // Fatal writes a message to the log and aborts. Fatal(v ...any) // Fatalf writes a formated message to the log and aborts. Fatalf(format string, v ...any) }
Logger is the interface for logging messages.
Click to show internal directories.
Click to hide internal directories.