# README
log
A high-level API adapter for logrus.
Overview
Package log
provides a high-level API adapter around logrus. It is intended as a personal utility. You are likely to prefer using Logrus directly.
This package makes the following changes to the logrus API:
- Functional options for a more user-friendly API.
- Adds
Logger.With
method, which applies log fields directly from objects satisfyingLoggable
. - Remove panic-level logging, as
Panic
andFatal
are semantically equivalent.
Escape hatches are provided to maintain full compatibility with Logrus
.
# Functions
Debug prints a message at debug level.
Debugf provides fmt.Printf-like formatting for a call to Trace.
Debugln calls Trace, adding a newline to the log output.
Error prints a message at error level.
Errorf provides fmt.Printf-like formatting for a call to Trace.
Errorln calls Trace, adding a newline to the log output.
Fatal prints each value then calls os.Exit(1).
Fatalf provides fmt.Printf-like formatting for a call to Fatal.
Fatalln calls Fatal, appending a newline to the log output.
Info prints a message at info level.
Infof provides fmt.Printf-like formatting for a call to Trace.
Infoln calls Trace, adding a newline to the log output.
New logger.
Trace prints a message at trace level.
Tracef provides fmt.Printf-like formatting for a call to Trace.
Traceln calls Trace, adding a newline to the log output.
Warn prints a message at warn level.
Warnf provides fmt.Printf-like formatting for a call to Trace.
Warnln calls Trace, adding a newline to the log output.
WithFormatter sets the formatter.
WithLevel sets the log level.
WithLevelHooks sets the level hooks.
WithWriter writer.
WrapLogrus is a convenience function.
# Constants
DebugLevel is used to report application state for debugging perposes.
ErrorLevel is used for errors that should definitely be noted.
FatalLevel logs and then calls `os.Exit(1)`.
InfoLevel provides general operational entries about what's going on inside the application.
TraceLevel is used to trace the execution steps of an application for debugging or optimization purposes.
WarnLevel is for non-critical entries that deserve eyes.
# Type aliases
F is a set of fields.
Level indicates the minimum severity threshold for logging.
LevelHooks is a collection of hooks that are synchronously triggered for each logging event.
Option for Logger.