log

package
v0.71.2 Latest Latest
Warning

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

Go to latest
Published: May 16, 2026 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Overview

Package log provides a high-performance, non-blocking logger for userspace networking

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Level

type Level uint32
const (
	LevelPanic Level = iota
	LevelFatal
	LevelError
	LevelWarn
	LevelInfo
	LevelDebug
	LevelTrace
)

type Logger

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

Logger is a high-performance, non-blocking logger

func NewFromLogrus

func NewFromLogrus(logrusLogger *log.Logger) *Logger

NewFromLogrus creates a new Logger that writes to the same output as the given logrus logger

func (*Logger) Debug

func (l *Logger) Debug(format string)

func (*Logger) Debug1 added in v0.53.0

func (l *Logger) Debug1(format string, arg1 any)

func (*Logger) Debug2 added in v0.53.0

func (l *Logger) Debug2(format string, arg1, arg2 any)

func (*Logger) Debug3 added in v0.59.9

func (l *Logger) Debug3(format string, arg1, arg2, arg3 any)

func (*Logger) Debugf added in v0.71.0

func (l *Logger) Debugf(format string, args ...any)

Debugf is the variadic shape. Dispatches to Debug/Debug1/Debug2/Debug3 to avoid allocating an args slice on the fast path when the arg count is known (0-3). Args beyond 3 land on the general variadic path; callers on the hot path should prefer DebugN for known counts.

func (*Logger) Enabled added in v0.71.0

func (l *Logger) Enabled(level Level) bool

Enabled reports whether the given level is currently logged. Callers on the hot path should guard log sites with this to avoid boxing arguments into any when the level is off.

func (*Logger) Error

func (l *Logger) Error(format string)

func (*Logger) Error1 added in v0.53.0

func (l *Logger) Error1(format string, arg1 any)

func (*Logger) Error2 added in v0.53.0

func (l *Logger) Error2(format string, arg1, arg2 any)

func (*Logger) Info

func (l *Logger) Info(format string)

func (*Logger) SetLevel

func (l *Logger) SetLevel(level Level)

SetLevel sets the logging level

func (*Logger) Stop

func (l *Logger) Stop(ctx context.Context) error

Stop gracefully shuts down the logger

func (*Logger) Trace

func (l *Logger) Trace(format string)

func (*Logger) Trace1 added in v0.53.0

func (l *Logger) Trace1(format string, arg1 any)

func (*Logger) Trace2 added in v0.53.0

func (l *Logger) Trace2(format string, arg1, arg2 any)

func (*Logger) Trace3 added in v0.53.0

func (l *Logger) Trace3(format string, arg1, arg2, arg3 any)

func (*Logger) Trace4 added in v0.53.0

func (l *Logger) Trace4(format string, arg1, arg2, arg3, arg4 any)

func (*Logger) Trace5 added in v0.53.0

func (l *Logger) Trace5(format string, arg1, arg2, arg3, arg4, arg5 any)

func (*Logger) Trace6 added in v0.53.0

func (l *Logger) Trace6(format string, arg1, arg2, arg3, arg4, arg5, arg6 any)

func (*Logger) Trace8 added in v0.59.9

func (l *Logger) Trace8(format string, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8 any)

Trace8 logs a trace message with 8 arguments (8 placeholder in format string)

func (*Logger) Warn

func (l *Logger) Warn(format string)

func (*Logger) Warn2 added in v0.71.0

func (l *Logger) Warn2(format string, arg1, arg2 any)

func (*Logger) Warn3 added in v0.53.0

func (l *Logger) Warn3(format string, arg1, arg2, arg3 any)

func (*Logger) Warn4 added in v0.62.2

func (l *Logger) Warn4(format string, arg1, arg2, arg3, arg4 any)

Jump to

Keyboard shortcuts

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