Documentation ¶
Overview ¶
ilog is a simple logging interface library package for Go. By defining only the logger interface `ilog.Logger`, users can easily swap out the underlying logging implementation without changing their application code.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrLogEntryIsNotWritten = errors.New("ilog: log entry not written")
ErrLogEntryIsNotWritten is the error returned when a log entry is not written.
Functions ¶
func NewBuilder ¶
NewBuilder returns a new Builder of ilog.Logger with the specified level and writer.
func SetStdLogger ¶
func SetStdLogger(l Logger) (rollback func())
Types ¶
type LogEntry ¶
type LogEntry interface { // Logger returns a new logger with the same fields of the log entry. Logger() (copied Logger) // error: for considering undispatched LogEntry as error so that they can be detected by Go static analysis. error // contains filtered or unexported methods }
LogEntry is the interface that has the logging methods for a single log entry.
type Logger ¶
type Logger interface { // Level returns the current logging level of the logger. Level() (currentLoggerLevel Level) // SetLevel sets the logging level of the logger. SetLevel(level Level) (copied Logger) // AddCallerSkip adds the number of stack frames to skip to the logger. AddCallerSkip(skip int) (copied Logger) // Copy returns a copy of the logger. Copy() (copied Logger) // contains filtered or unexported methods }
Logger is the interface that has the basic logging methods.
func FromContext ¶
Click to show internal directories.
Click to hide internal directories.