xlog

package
v0.57.0 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2024 License: Apache-2.0 Imports: 4 Imported by: 19

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 added in v0.53.0

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 added in v0.53.0

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

func (*Logger) AppendPrefix

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

func (*Logger) Debugf added in v0.55.0

func (l *Logger) Debugf(format string, v ...interface{})

func (*Logger) Errorf added in v0.55.0

func (l *Logger) Errorf(format string, v ...interface{})

func (*Logger) Infof added in v0.55.0

func (l *Logger) Infof(format string, v ...interface{})

func (*Logger) ResetPrefixes

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

func (*Logger) Spawn

func (l *Logger) Spawn() *Logger

func (*Logger) Tracef added in v0.55.0

func (l *Logger) Tracef(format string, v ...interface{})

func (*Logger) Warnf added in v0.55.0

func (l *Logger) Warnf(format string, v ...interface{})

Jump to

Keyboard shortcuts

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