Help us shape the future of Go! Take the 2026 Go Developer Survey

xlog

package
v1.1.9 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2025 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewContext

func NewContext(ctx context.Context, xl *Logger) context.Context

Types

type LogPrefix

type LogPrefix struct {
	// Name is the name of the prefix, it won't be displayed in log but used to identify the prefix.
	Name string
	// Value is the value of the prefix, it will be displayed in log.
	Value string
	// The prefix with higher priority will be displayed first, default is 10.
	Priority int
}

type Logger

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

Logger is not thread safety for operations on prefix

func FromContext

func FromContext(ctx context.Context) (xl *Logger, ok bool)

func FromContextSafe

func FromContextSafe(ctx context.Context) *Logger

func New

func New() *Logger

func (*Logger) AddPrefix

func (l *Logger) AddPrefix(prefix LogPrefix) *Logger

func (*Logger) AppendPrefix

func (l *Logger) AppendPrefix(prefix string) *Logger

func (*Logger) Debugf

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

func (*Logger) Errorf

func (l *Logger) Errorf(format string, v ...any)

func (*Logger) Infof

func (l *Logger) Infof(format string, v ...any)

func (*Logger) ResetPrefixes

func (l *Logger) ResetPrefixes() (old []LogPrefix)

func (*Logger) Spawn

func (l *Logger) Spawn() *Logger

func (*Logger) Tracef

func (l *Logger) Tracef(format string, v ...any)

func (*Logger) Warnf

func (l *Logger) Warnf(format string, v ...any)

Jump to

Keyboard shortcuts

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