glog

package
v1.0.4-snapshot Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Debug

func Debug(ctx context.Context, msg string)

func DebugWithFields

func DebugWithFields(ctx context.Context, fields logrus.Fields, msg string)

func Debugf

func Debugf(ctx context.Context, format string, args ...interface{})

func DebugfWithFields

func DebugfWithFields(ctx context.Context, fields logrus.Fields, msg string, args ...interface{})

func Error

func Error(ctx context.Context, msg string)

func ErrorWithFields

func ErrorWithFields(ctx context.Context, fields logrus.Fields, msg string)

func Errorf

func Errorf(ctx context.Context, format string, args ...interface{})

func ErrorfWithFields

func ErrorfWithFields(ctx context.Context, fields logrus.Fields, msg string, args ...interface{})

func GetLogLevel

func GetLogLevel(level string) int32

func Info

func Info(ctx context.Context, msg string)

func InfoWithFields

func InfoWithFields(ctx context.Context, fields logrus.Fields, msg string)

func Infof

func Infof(ctx context.Context, format string, args ...interface{})

func InfofWithFields

func InfofWithFields(ctx context.Context, fields logrus.Fields, msg string, args ...interface{})

func InitLogger

func InitLogger(ctx context.Context)

InitLogger 初始化日志配置(支持每日+大小轮转)

func Warn

func Warn(ctx context.Context, msg string)

func WarnWithFields

func WarnWithFields(ctx context.Context, fields logrus.Fields, msg string)

func Warnf

func Warnf(ctx context.Context, format string, args ...interface{})

func WarnfWithFields

func WarnfWithFields(ctx context.Context, fields logrus.Fields, msg string, args ...interface{})

Types

type DailySizeRotator

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

DailySizeRotator 结合每日切换和大小切割的日志轮转器

func NewDailySizeRotator

func NewDailySizeRotator(config config.LoggerConfig) (*DailySizeRotator, error)

NewDailySizeRotator 创建轮转器实例

func (*DailySizeRotator) Close

func (d *DailySizeRotator) Close() error

Close 关闭轮转器(释放资源)

func (*DailySizeRotator) Write

func (d *DailySizeRotator) Write(p []byte) (n int, err error)

Write 实现io.Writer接口,将日志写入当前lumberjack实例

type FileHook

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

FileHook 文件输出Hook

func (*FileHook) Fire

func (hook *FileHook) Fire(entry *logrus.Entry) error

Fire 执行Hook

func (*FileHook) Levels

func (hook *FileHook) Levels() []logrus.Level

Levels 返回支持的日志级别

type OrderedJSONFormatter

type OrderedJSONFormatter struct {
	FieldOrder      []string
	TimestampFormat string
}

OrderedJSONFormatter 自定义JSON格式化器

func (*OrderedJSONFormatter) Format

func (f *OrderedJSONFormatter) Format(entry *logrus.Entry) ([]byte, error)

Format 实现logrus.Format接口

type SimpleTextFormatter

type SimpleTextFormatter struct{}

SimpleTextFormatter 简单文本格式化器(|分隔)

func (*SimpleTextFormatter) Format

func (f *SimpleTextFormatter) Format(entry *logrus.Entry) ([]byte, error)

Format 实现logrus.Formatter接口

Jump to

Keyboard shortcuts

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