log

package
v2.0.0-alpha.1 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2025 License: GPL-3.0, LGPL-3.0 Imports: 5 Imported by: 0

Documentation

Overview

Package log provides a compatibility layer for go-ethereum style logging that redirects to luxfi/log

Index

Constants

View Source
const (
	// Level constants - use slog.Level values directly to avoid conflicts
	LevelTrace slog.Level = -8
	LevelDebug            = slog.LevelDebug
	LevelInfo             = slog.LevelInfo
	LevelWarn             = slog.LevelWarn
	LevelError            = slog.LevelError
	LevelCrit  slog.Level = 12

	// Backward compatibility
	LvlTrace = LevelTrace
	LvlInfo  = LevelInfo
	LvlDebug = LevelDebug
)

Variables

View Source
var (
	New  = luxlog.New
	Root = luxlog.Root
)

Re-export functions from luxfi/log

Functions

func Crit

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

func Debug

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

func DiscardHandler

func DiscardHandler() slog.Handler

DiscardHandler returns a handler that discards all log records

func Enabled

func Enabled(ctx context.Context, level slog.Level) bool

func Error

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

func FileHandler

func FileHandler(path string, fmtr Formatter) (slog.Handler, error)

FileHandler returns a handler that writes to a file

func FromLegacyLevel

func FromLegacyLevel(lvl int) slog.Level

FromLegacyLevel converts from old Geth verbosity level constants

func Info

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

func LevelAlignedString

func LevelAlignedString(l slog.Level) string

LevelAlignedString returns a 5-character string containing the name of a level

func LevelString

func LevelString(l slog.Level) string

LevelString returns a string containing the name of a level

func LvlFilterHandler

func LvlFilterHandler(maxLevel slog.Level, h slog.Handler) slog.Handler

LvlFilterHandler returns a handler that filters by level

func LvlFromString

func LvlFromString(lvlString string) (slog.Level, error)

LvlFromString returns the appropriate level from a string name

func NewTerminalHandler

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

NewTerminalHandler creates a handler that writes to terminal

func SetDefault

func SetDefault(l Logger)

SetDefault sets the default logger

func StreamHandler

func StreamHandler(w io.Writer, fmtr Formatter) slog.Handler

StreamHandler returns a handler that writes to an io.Writer

func Trace

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

Global logging functions

func Warn

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

Types

type Formatter

type Formatter interface{}

Formatter interface for compatibility

func JSONFormat

func JSONFormat() Formatter

JSONFormat returns a JSON formatter

func TerminalFormat

func TerminalFormat(useColor bool) Formatter

TerminalFormat returns a terminal formatter

type GlogHandler

type GlogHandler struct {
	// contains filtered or unexported fields
}

Handler types for compatibility

func NewGlogHandler

func NewGlogHandler(handler slog.Handler) *GlogHandler

NewGlogHandler creates a new glog handler

func (*GlogHandler) SetHandler

func (h *GlogHandler) SetHandler(handler slog.Handler)

SetHandler sets the handler (no-op for compatibility)

func (*GlogHandler) Verbosity

func (h *GlogHandler) Verbosity(level slog.Level)

Verbosity sets the verbosity level (no-op for compatibility)

type Logger

type Logger = luxlog.Logger

Re-export types and constants from luxfi/log

func NewLogger

func NewLogger(h slog.Handler) Logger

NewLogger returns a logger with the specified handler set

Jump to

Keyboard shortcuts

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