logs

package
v0.26.55 Latest Latest
Warning

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

Go to latest
Published: May 5, 2025 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Debug

func Debug(msg string, v ...interface{})

func EnableInMemoryBuffer

func EnableInMemoryBuffer(capacity int)

func Error

func Error(msg string, v ...interface{})

func Fatal

func Fatal(msg string, v ...interface{})

func GetBufferedLogs

func GetBufferedLogs() string

func Info

func Info(msg string, v ...interface{})

func Init

func Init(
	logType, logLevel, logPath string,
	maxSize, maxBackups, maxAge int,
	compress bool,
)

Init 初始化全局 logger。 logType: "stdout"|"file"|"both"|"off" logLevel: "trace"|"debug"|"info"|"warn"|"error"|"fatal"|"panic"|"off" logPath: 文件路径(file/both 模式必填) maxSize: 单文件最大 MB maxBackups:最大备份个数 maxAge: 最大保留天数 compress: 是否压缩旧日志

func Panic

func Panic(msg string, v ...interface{})

func SetLevel

func SetLevel(levelStr string)

func Trace

func Trace(msg string, v ...interface{})

func Warn

func Warn(msg string, v ...interface{})

Types

type BufferWriter

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

func NewBufferWriter

func NewBufferWriter(capacity int) *BufferWriter

func (*BufferWriter) GetAndClear

func (w *BufferWriter) GetAndClear() string

func (*BufferWriter) Write

func (w *BufferWriter) 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