# Functions
Crit is a convenient alias for Root().Crit
Log a message at the crit level with context key/value pairs, and then exit.
Debug is a convenient alias for Root().Debug
Log a message at the debug level with context key/value pairs
# Usage Examples
log.Debug("msg") log.Debug("msg", "key1", val1) log.Debug("msg", "key1", val1, "key2", val2).
DiscardHandler returns a no-op handler.
Error is a convenient alias for Root().Error
Log a message at the error level with context key/value pairs
# Usage Examples
log.Error("msg") log.Error("msg", "key1", val1) log.Error("msg", "key1", val1, "key2", val2).
FormatLogfmtUint64 formats n with thousand separators.
FormatSlogValue formats a slog.Value for serialization to terminal.
FromLegacyLevel converts from old Geth verbosity level constants to levels defined by slog.
Info is a convenient alias for Root().Info
Log a message at the info level with context key/value pairs
# Usage Examples
log.Info("msg") log.Info("msg", "key1", val1) log.Info("msg", "key1", val1, "key2", val2).
JSONHandler returns a handler which prints records in JSON format.
JSONHandlerWithLevel returns a handler which prints records in JSON format that are less than or equal to the specified verbosity level.
LevelAlignedString returns a 5-character string containing the name of a Lvl.
LevelString returns a string containing the name of a Lvl.
LogfmtHandler returns a handler which prints records in logfmt format, an easy machine-parseable but human-readable format for key/value pairs.
LogfmtHandlerWithLevel returns the same handler as LogfmtHandler but it only outputs records which are less than or equal to the specified verbosity level.
New returns a new logger with the given context.
NewGlogHandler creates a new log handler with filtering functionality similar to Google's glog logger.
NewLogger returns a logger with the specified handler set.
NewTerminalHandler returns a handler which formats log records at all levels optimized for human readability on a terminal with color-coded level output and terser human friendly timestamp.
NewTerminalHandlerWithLevel returns the same handler as NewTerminalHandler but only outputs records which are less than or equal to the specified verbosity level.
Root returns the root logger.
SetDefault sets the default global logger.
Trace is a convenient alias for Root().Trace
Log a message at the trace level with context key/value pairs
# Usage
log.Trace("msg") log.Trace("msg", "key1", val1) log.Trace("msg", "key1", val1, "key2", val2).
Warn is a convenient alias for Root().Warn
Log a message at the warn level with context key/value pairs
# Usage Examples
log.Warn("msg") log.Warn("msg", "key1", val1) log.Warn("msg", "key1", val1, "key2", val2).
# Constants
for backward-compatibility.
# Structs
GlogHandler is a log handler that mimics the filtering features of Google's glog logger: setting global log levels; overriding with callsite pattern matches; and requesting backtraces at certain positions.
# Interfaces
A Logger writes key/value pairs to a Handler.
TerminalStringer is an analogous interface to the stdlib stringer, allowing own types to have custom shortened serialization formats when printed to the screen.