log

package
v1.16.76 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 11, 2026 License: GPL-3.0, BSD-3-Clause Imports: 5 Imported by: 10

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

View Source
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 Crit

func Crit(msg string, ctx ...interface{})

func Debug

func Debug(msg string, ctx ...interface{})

func DiscardHandler

func DiscardHandler() slog.Handler

func Error

func Error(msg string, ctx ...interface{})

func Fatal added in v1.16.76

func Fatal(msg string, ctx ...interface{})

func FormatLogfmtUint64

func FormatLogfmtUint64(n uint64) string

FormatLogfmtUint64 formats a uint64 as a compact string.

func Info

func Info(msg string, ctx ...interface{})

func JSONHandler

func JSONHandler(wr io.Writer) slog.Handler

func JSONHandlerWithLevel

func JSONHandlerWithLevel(wr io.Writer, level slog.Level) slog.Handler

func Log added in v1.16.76

func Log(level Level, msg string, ctx ...interface{})

func LogfmtHandler

func LogfmtHandler(wr io.Writer) slog.Handler

func LogfmtHandlerWithLevel

func LogfmtHandlerWithLevel(wr io.Writer, level slog.Level) slog.Handler

func NewTerminalHandler

func NewTerminalHandler(wr io.Writer, useColor bool) slog.Handler

func NewTerminalHandlerWithLevel

func NewTerminalHandlerWithLevel(wr io.Writer, lvl slog.Level, useColor bool) slog.Handler

func SetDefault

func SetDefault(l Logger)

SetDefault sets the default global logger.

func SetSlogDefault added in v1.16.76

func SetSlogDefault(l Logger)

SetSlogDefault sets the slog default logger (compatibility).

func Trace

func Trace(msg string, ctx ...interface{})

Package-level logging functions. Crit/Fatal log the message to stderr then exit — unlike the upstream slog DiscardHandler which silently exits.

func Warn

func Warn(msg string, ctx ...interface{})

Types

type Level added in v1.16.76

type Level = luxlog.Level

Level re-exports from luxfi/log.

type Logger

type Logger = luxlog.Logger

Logger is the geth-compatible logger interface.

func New

func New(ctx ...interface{}) Logger

New creates a new logger with the given context.

func NewLogger

func NewLogger(_ slog.Handler) Logger

NewLogger creates a new logger from an slog.Handler (compatibility shim).

func NewNoOpLogger added in v1.16.76

func NewNoOpLogger() Logger

NewNoOpLogger returns a disabled logger.

func NewTestLogger added in v1.16.76

func NewTestLogger(level ...Level) Logger

NewTestLogger returns a logger suitable for testing.

func Root

func Root() Logger

Root returns the root logger.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL