xlog

package
v0.61.0 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2024 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 ...interface{})

func (*Logger) Errorf

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

func (*Logger) Infof

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

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

func (*Logger) Warnf

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