klog

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2022 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Debug

func Debug(args ...interface{})

func Debugf

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

func Debugs

func Debugs(args ...interface{})

func Error

func Error(args ...interface{})

func Errorf

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

func Errors

func Errors(args ...interface{})

func Fatal

func Fatal(args ...interface{})

Fatal方法调用后直接os.Exit(1),慎用

func Fatalf

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

func Fatals

func Fatals(args ...interface{})

func GRPCUnaryClientRequestLogging

func GRPCUnaryClientRequestLogging() grpc.UnaryClientInterceptor

func GRPCUnaryClientTraceLog

func GRPCUnaryClientTraceLog(l *Logger) grpc.UnaryClientInterceptor

ClientInterceptor grpc client wrapper

func GRPCUnaryServerRequestLogging

func GRPCUnaryServerRequestLogging() grpc.UnaryServerInterceptor

func GRPCUnaryServerTraceLog

func GRPCUnaryServerTraceLog(l *Logger) grpc.UnaryServerInterceptor

func HTTPServerTraceLog

func HTTPServerTraceLog(l *Logger) gin.HandlerFunc

func Info

func Info(args ...interface{})

func Infof

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

func Infos

func Infos(args ...interface{})

func InitLogger

func InitLogger(opts ...*Option)

InitLogger is to initialize Logger

func Panic

func Panic(args ...interface{})

Panic方法调用后直接Panic,慎用

func Panicf

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

func Panics

func Panics(args ...interface{})

func RestyLogging

func RestyLogging() func(c *resty.Client, res *resty.Response) error

func Warn

func Warn(args ...interface{})

func Warnf

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

func Warns

func Warns(args ...interface{})

func WithRestyTraceLog

func WithRestyTraceLog(l *Logger) func(*resty.Client, *resty.Request) error

func WithTraceCtx

func WithTraceCtx(l *Logger, ctx context.Context) context.Context

Types

type GormLogger

type GormLogger struct {
	Logger *Logger

	SlowThreshold time.Duration
	// contains filtered or unexported fields
}

func (GormLogger) Error

func (w GormLogger) Error(_ context.Context, msg string, data ...interface{})

func (GormLogger) Info

func (w GormLogger) Info(_ context.Context, msg string, data ...interface{})

func (*GormLogger) Log

func (w *GormLogger) Log(keyvals ...interface{}) error

func (*GormLogger) LogMode

func (w *GormLogger) LogMode(level glogger.LogLevel) glogger.Interface

func (GormLogger) Trace

func (w GormLogger) Trace(_ context.Context, begin time.Time, fc func() (string, int64), err error)

func (GormLogger) Warn

func (w GormLogger) Warn(_ context.Context, msg string, data ...interface{})

type JaegerLogger

type JaegerLogger struct {
	Logger *Logger
}

func (*JaegerLogger) Debugf

func (l *JaegerLogger) Debugf(msg string, args ...interface{})

Infof logs a message at info priority

func (*JaegerLogger) Error

func (l *JaegerLogger) Error(msg string)

Error logs a message at error priority

func (*JaegerLogger) Infof

func (l *JaegerLogger) Infof(msg string, args ...interface{})

Infof logs a message at info priority

func (*JaegerLogger) Log

func (l *JaegerLogger) Log(keyvals ...interface{}) error

type KcronLogger

type KcronLogger struct {
	Logger *Logger
}

func (*KcronLogger) Error

func (w *KcronLogger) Error(err error, msg string, keysAndValues ...interface{})

func (*KcronLogger) Info

func (w *KcronLogger) Info(msg string, keysAndValues ...interface{})

func (*KcronLogger) Log

func (w *KcronLogger) Log(keyvals ...interface{}) error

type Level

type Level int8

Level defines log levels.

const (
	// DebugLevel defines debug log level.
	DebugLevel Level = iota
	// InfoLevel defines info log level.
	InfoLevel
	// WarnLevel defines warn log level.
	WarnLevel
	// ErrorLevel defines error log level.
	ErrorLevel
	// FatalLevel defines fatal log level.
	FatalLevel
	// PanicLevel defines panic log level.
	PanicLevel
	// NoLevel defines an absent log level.
	NoLevel
	// Disabled disables the logger.
	Disabled

	// TraceLevel defines trace log level.
	TraceLevel Level = -1
)

func LevelUnmarshalText

func LevelUnmarshalText(text string) (level Level, err error)

LevelUnmarshalText level in config unmarshal to log.level

type Logger

type Logger struct {
	*zerolog.Logger
	Writer io.Writer
}

func DefaultLogger

func DefaultLogger() *Logger

func FromTraceCtx

func FromTraceCtx(ctx context.Context) *Logger

func NewLogger

func NewLogger(opts ...*Option) *Logger

func NewLoggerWith

func NewLoggerWith(zlogger *zerolog.Logger) *Logger

func (*Logger) AutoLevel

func (l *Logger) AutoLevel(confKey string)

AutoLevel ...

func (*Logger) Log

func (l *Logger) Log(keyvals ...interface{}) error

func (*Logger) NewLogger

func (l *Logger) NewLogger() *Logger

func (*Logger) SetLevel

func (l *Logger) SetLevel(level Level) *Logger

type NacosLogger

type NacosLogger struct {
	Logger *Logger
}

func (*NacosLogger) Debug

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

func (*NacosLogger) Debugf

func (l *NacosLogger) Debugf(fmt string, args ...interface{})

func (*NacosLogger) Error

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

func (*NacosLogger) Errorf

func (l *NacosLogger) Errorf(fmt string, args ...interface{})

func (*NacosLogger) Info

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

func (*NacosLogger) Infof

func (l *NacosLogger) Infof(fmt string, args ...interface{})

func (*NacosLogger) Level

func (l *NacosLogger) Level(level string)

func (*NacosLogger) Log

func (l *NacosLogger) Log(keyvals ...interface{}) error

func (*NacosLogger) Warn

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

func (*NacosLogger) Warnf

func (l *NacosLogger) Warnf(fmt string, args ...interface{})

type Option

type Option struct {
	Writer io.Writer
	Level  Level
}

func ConfigOption

func ConfigOption(key string) (*Option, error)

RawConfig ...

func NewOption

func NewOption() *Option

func SetLevel

func SetLevel(l Level) *Option

func SetWriter

func SetWriter(w io.Writer) *Option

func (*Option) MergeOption

func (c *Option) MergeOption(opts ...*Option) *Option

func (*Option) SetLevel

func (c *Option) SetLevel(l Level) *Option

func (*Option) SetWriter

func (c *Option) SetWriter(w io.Writer) *Option

type RocketmqLogger

type RocketmqLogger struct {
	Logger *Logger
}

func (*RocketmqLogger) Debug

func (w *RocketmqLogger) Debug(msg string, fields map[string]interface{})

func (*RocketmqLogger) Error

func (w *RocketmqLogger) Error(msg string, fields map[string]interface{})

func (*RocketmqLogger) Fatal

func (w *RocketmqLogger) Fatal(msg string, fields map[string]interface{})

func (*RocketmqLogger) Info

func (w *RocketmqLogger) Info(msg string, fields map[string]interface{})

func (*RocketmqLogger) Level

func (w *RocketmqLogger) Level(level string)

func (*RocketmqLogger) Log

func (w *RocketmqLogger) Log(keyvals ...interface{}) error

func (*RocketmqLogger) OutputPath

func (w *RocketmqLogger) OutputPath(path string) (err error)

func (*RocketmqLogger) Warning

func (w *RocketmqLogger) Warning(msg string, fields map[string]interface{})

type SentinelLogger

type SentinelLogger struct {
	Logger *Logger
}

func (*SentinelLogger) Debug

func (w *SentinelLogger) Debug(msg string, keysAndValues ...interface{})

func (*SentinelLogger) DebugEnabled

func (w *SentinelLogger) DebugEnabled() bool

func (*SentinelLogger) Error

func (w *SentinelLogger) Error(err error, msg string, keysAndValues ...interface{})

func (*SentinelLogger) ErrorEnabled

func (w *SentinelLogger) ErrorEnabled() bool

func (*SentinelLogger) Info

func (w *SentinelLogger) Info(msg string, keysAndValues ...interface{})

func (*SentinelLogger) InfoEnabled

func (w *SentinelLogger) InfoEnabled() bool

func (*SentinelLogger) Log

func (w *SentinelLogger) Log(keyvals ...interface{}) error

func (*SentinelLogger) Warn

func (w *SentinelLogger) Warn(msg string, keysAndValues ...interface{})

func (*SentinelLogger) WarnEnabled

func (w *SentinelLogger) WarnEnabled() bool

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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