Documentation
¶
Overview ¶
Package log re-exports github.com/luxfi/log for backward compatibility. All geth-style logging functions (Crit, Fatal, Error, Warn, Info, Debug, Trace) are provided by luxfi/log which writes to stderr by default.
Unlike the upstream go-ethereum log package which uses slog with a DiscardHandler (silently swallowing log.Crit messages before calling os.Exit), this package ensures all log output is visible through the unified luxfi/log infrastructure.
Index ¶
- Constants
- func Crit(msg string, ctx ...interface{})
- func Debug(msg string, ctx ...interface{})
- func DiscardHandler() slog.Handler
- func Error(msg string, ctx ...interface{})
- func Fatal(msg string, ctx ...interface{})
- func FormatLogfmtUint64(n uint64) string
- func Info(msg string, ctx ...interface{})
- func JSONHandler(wr io.Writer) slog.Handler
- func JSONHandlerWithLevel(wr io.Writer, level slog.Level) slog.Handler
- func Log(level Level, msg string, ctx ...interface{})
- func LogfmtHandler(wr io.Writer) slog.Handler
- func LogfmtHandlerWithLevel(wr io.Writer, level slog.Level) slog.Handler
- func NewTerminalHandler(wr io.Writer, useColor bool) slog.Handler
- func NewTerminalHandlerWithLevel(wr io.Writer, lvl slog.Level, useColor bool) slog.Handler
- func SetDefault(l Logger)
- func SetSlogDefault(l Logger)
- func Trace(msg string, ctx ...interface{})
- func Warn(msg string, ctx ...interface{})
- type Level
- type Logger
Constants ¶
const ( LevelTrace slog.Level = -8 LevelDebug = slog.LevelDebug LevelInfo = slog.LevelInfo LevelWarn = slog.LevelWarn LevelError = slog.LevelError LevelCrit slog.Level = 12 )
slog-compatible level constants for geth code that references these.
Variables ¶
This section is empty.
Functions ¶
func DiscardHandler ¶
func FormatLogfmtUint64 ¶
FormatLogfmtUint64 formats a uint64 as a compact string.
func LogfmtHandlerWithLevel ¶
func SetSlogDefault ¶ added in v1.16.76
func SetSlogDefault(l Logger)
SetSlogDefault sets the slog default logger (compatibility).
Types ¶
type Logger ¶
Logger is the geth-compatible logger interface.
func NewNoOpLogger ¶ added in v1.16.76
func NewNoOpLogger() Logger
NewNoOpLogger returns a disabled logger.
func NewTestLogger ¶ added in v1.16.76
NewTestLogger returns a logger suitable for testing.