logger

package
v0.8.5 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Set

func Set(config *Logger)

Types

type Logger

type Logger struct {
	Handler       *slog.Handler
	DirPath       string         //日志目录
	OutputJson    bool           //是否写入json格式
	WriteStdout   bool           //是否写入控制台
	WriteFile     bool           //是否写入日志文件
	Level         slog.Leveler   //写入的日志等级
	Levels        []slog.Leveler //写入的日志等级
	Lumberjack    *Lumberjack    //日志文件切割
	WriteInterval time.Duration  //日志文件写入间隔
}

func Get

func Get() *Logger

type Lumberjack

type Lumberjack struct {
	FileNameFormat func() string //文件名格式
	MaxSize        int           //在进行切割之前,日志文件的最大值(以MB为单位)
	MaxBackups     int           //保留旧文件的最大个数
	MaxAge         int           //保留旧文件的最大天数
}

Lumberjack 文件切割

Jump to

Keyboard shortcuts

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