log

package
v0.5.18 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2024 License: MIT Imports: 6 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultLogger  Logger
	DefaultBuilder Builder
)
View Source
var (
	LevelAll   xlog.Level = xlog.LevelAll
	LevelDebug xlog.Level = xlog.LevelDebug
	LevelInfo  xlog.Level = xlog.LevelInfo
	LevelWarn  xlog.Level = xlog.LevelWarn
	LevelError xlog.Level = xlog.LevelError
	LevelPanic xlog.Level = xlog.LevelPanic

	LevelFatal xlog.Level = xlog.LevelFatal
	LevelOff   xlog.Level = xlog.LevelOff
)
View Source
var (
	WithName    = xlog.WithName
	WithSid     = xlog.WithSid
	WithSrvType = xlog.WithSrvType
	WithField   = xlog.WithField
	WithFields  = xlog.WithFields
)
View Source
var (
	WithConfigPath  = xlog.WithConfigPath
	WithLayout      = xlog.WithLayout
	WithConcurrency = xlog.WithConcurrency
)

Functions

func Close

func Close()

func Config added in v0.5.12

func Config(opts ...ConfigOption) error

func Debug

func Debug(args ...interface{})

func Debugf

func Debugf(template string, args ...interface{})

func Error

func Error(args ...interface{})

func Errorf

func Errorf(template string, args ...interface{})

func Info

func Info(args ...interface{})

func Infof

func Infof(template string, args ...interface{})

func Panic

func Panic(args ...interface{})

func Panicf

func Panicf(template string, args ...interface{})

func Register added in v0.1.31

func Register(builder Builder)

func Warn

func Warn(args ...interface{})

func Warnf

func Warnf(template string, args ...interface{})

func WithContext

func WithContext(ctx context.Context, l Logger) context.Context

Types

type Builder

type Builder interface {
	Name() string
	Build(context.Context, ...Option) Logger
	Close()
}

func GetBuilder added in v0.1.31

func GetBuilder(builderName string) (Builder, bool)

type ConfigOption added in v0.5.12

type ConfigOption = xlog.ConfigOption

type Level

type Level = xlog.Level

type Logger

type Logger interface {
	Name() string

	SessionID() string

	Log(level Level, args ...interface{})
	Logf(level Level, format string, args ...interface{})

	Info(args ...interface{})
	Infof(format string, args ...interface{})

	Error(args ...interface{})
	Errorf(format string, args ...interface{})

	Debug(args ...interface{})
	Debugf(format string, args ...interface{})

	Panic(args ...interface{})
	Panicf(format string, args ...interface{})

	Fatal(args ...interface{})
	Fatalf(format string, args ...interface{})

	Warn(v ...interface{})
	Warnf(format string, v ...interface{})

	Write(p []byte) (n int, err error)
	Close()
}

func FromContext

func FromContext(ctx context.Context) (Logger, bool)

func New

func New(ctx context.Context, opts ...Option) Logger

type Option

type Option = xlog.Option

type Options added in v0.1.13

type Options struct {
	WithRequest  bool
	WithResponse bool
	Excludes     []string
	// contains filtered or unexported fields
}

func (*Options) IsExclude added in v0.1.13

func (opts *Options) IsExclude(path string) bool

type ServerOption added in v0.1.13

type ServerOption func(opt *Options)

func Excludes deprecated added in v0.1.13

func Excludes(excludes ...string) ServerOption

Deprecated: use func (e *Server) Handle(path string, obj interface{}, opts ...engine.RouterOption) 中Opts代替

func WithRequest added in v0.1.13

func WithRequest() ServerOption

func WithResponse added in v0.1.13

func WithResponse() ServerOption

type Wraper added in v0.5.12

type Wraper struct {
	Logger xlog.Logger
}

func (*Wraper) Close added in v0.5.12

func (l *Wraper) Close()

func (*Wraper) Debug added in v0.5.12

func (l *Wraper) Debug(args ...interface{})

func (*Wraper) Debugf added in v0.5.12

func (l *Wraper) Debugf(format string, args ...interface{})

func (*Wraper) Error added in v0.5.12

func (l *Wraper) Error(args ...interface{})

func (*Wraper) Errorf added in v0.5.12

func (l *Wraper) Errorf(format string, args ...interface{})

func (*Wraper) Fatal added in v0.5.12

func (l *Wraper) Fatal(args ...interface{})

func (*Wraper) Fatalf added in v0.5.12

func (l *Wraper) Fatalf(format string, args ...interface{})

func (*Wraper) Info added in v0.5.12

func (l *Wraper) Info(args ...interface{})

func (*Wraper) Infof added in v0.5.12

func (l *Wraper) Infof(format string, args ...interface{})

func (*Wraper) Log added in v0.5.12

func (l *Wraper) Log(level Level, args ...interface{})

func (*Wraper) Logf added in v0.5.12

func (l *Wraper) Logf(level Level, format string, args ...interface{})

func (*Wraper) Name added in v0.5.12

func (l *Wraper) Name() string

func (*Wraper) Panic added in v0.5.12

func (l *Wraper) Panic(args ...interface{})

func (*Wraper) Panicf added in v0.5.12

func (l *Wraper) Panicf(format string, args ...interface{})

func (*Wraper) SessionID added in v0.5.12

func (l *Wraper) SessionID() string

func (*Wraper) Warn added in v0.5.12

func (l *Wraper) Warn(args ...interface{})

func (*Wraper) Warnf added in v0.5.12

func (l *Wraper) Warnf(format string, args ...interface{})

func (*Wraper) Write added in v0.5.12

func (l *Wraper) Write(p []byte) (n int, err error)

Jump to

Keyboard shortcuts

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