log

package
v1.1.7 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LevelDebug = "debug"
	LevelInfo  = "info"
	LevelError = "error"
	LevelWarn  = "warn"
)

Variables

This section is empty.

Functions

func Debug

func Debug(msg ...interface{})

Debug 输出日志

func Debugf

func Debugf(format string, msg ...interface{})

Debugf 按照格式输出日志

func Error

func Error(msg ...interface{})

Error 输出日志

func Errorf

func Errorf(format string, msg ...interface{})

Errorf 按照格式输出日志

func Info

func Info(msg ...interface{})

Info 输出日志

func Infof

func Infof(format string, msg ...interface{})

Infof 按照格式输出日志

func IsDebug

func IsDebug() bool

func SetLevel

func SetLevel(level string)

SetLevel 动态修改系统的日志级别

func SetLogConf

func SetLogConf(configFile string)

SetLogConf 将json数据读取出来并进行初始化

func Warn

func Warn(msg ...interface{})

func Warnf

func Warnf(format string, msg ...interface{})

Types

type Config

type Config struct {
	Logs  []LevelConfig `json:"logs"`
	Level string        `json:"level"`
}

Config 完整配置

type LevelConfig

type LevelConfig struct {
	Filename   string `json:"logpath"`
	MaxSize    int    `json:"maxsize"`
	MaxBackups int    `json:"backups"`
	MaxAge     int    `json:"maxage"`
	Compress   bool   `json:"compress"`
	Name       string `json:"name"`
	//0默认为lumberjack,1 小时,2 分钟,3 天
	Type int `json:"type"`
	//滚动时间,type=1 单位:小时,type=2 单位:分钟, type=3 单位:天
	Rotation int `json:"rotation"`
}

LevelConfig 日志配置结构体

type ShortConfig

type ShortConfig struct {
	Level string `json:"level"`
}

ShortConfig 级别配置

Jump to

Keyboard shortcuts

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