logger

package
v0.2.1 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: 13 Imported by: 18

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Debug

func Debug(v ...any)

func Debugf

func Debugf(format string, v ...any)

func Error

func Error(v ...any)

func Errorf

func Errorf(format string, v ...any)

func Fatal

func Fatal(v ...any)

func Fatalf

func Fatalf(format string, v ...any)

func Info

func Info(v ...any)

func Infof

func Infof(format string, v ...any)

func InitLogger

func InitLogger(path string, level LogLevel)

InitLogger 初始化全局日志模块

func IsDebug

func IsDebug() bool

IsDebug 是否debug日志模式

func NewTextLoggerWithCompression

func NewTextLoggerWithCompression(cfg Config) *zap.Logger

NewTextLoggerWithCompression 初始化支持压缩的纯文本日志配置

func Warn

func Warn(v ...any)

func Warnf

func Warnf(format string, v ...any)

Types

type Config

type Config struct {
	Level         zapcore.Level // 日志级别
	Path          string        // 路径
	EnableConsole bool          // 控制台开关
	MaxAge        time.Duration // 最大保留时间
	RotationTime  time.Duration // 日志切割时间
	BufferSize    int           // 缓冲区大小, 单位KB
	FlushInterval time.Duration // 定时刷新间隔, 单位秒
}

Config 日志配置

type LogLevel

type LogLevel uint8
const (
	DEBUG LogLevel = iota
	INFO
	WARN
	ERROR
	OFF
	FATAL
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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