logger

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2023 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var GetLevelByName func(string) Level

GetLevelByName 过日志级别名称获取日志级别

View Source
var LogNameMap = map[Level]string{
	LevelEmerg:   "emerg",
	LevelAlter:   "alert",
	LevelCrit:    "crit",
	LevelError:   "error",
	LevelWarning: "warning",
	LevelNotice:  "notice",
	LevelInfo:    "info",
	LevelDebug:   "debug",
}

LogNameMap 日志级别映射

Functions

func LevelGetter

func LevelGetter() func(string) Level

Types

type Level

type Level int64

Level 日志级别

const (
	LevelEmerg Level = iota
	LevelAlter
	LevelCrit
	LevelError
	LevelWarning
	LevelNotice
	LevelInfo
	LevelDebug

	LevelCount // count
)

8种日志级别

type Logger

type Logger interface {
	Log(Level, string, ...any)
	LogEmerg(string, ...any)
	LogAlter(string, ...any)
	LogCrit(string, ...any)
	LogError(string, ...any)
	LogWarning(string, ...any)
	LogNotice(string, ...any)
	LogInfo(string, ...any)
	LogDebug(string, ...any)
	CanLog(Level) bool
}

Logger 接口

Directories

Path Synopsis
chain 使用日志链记录日志
chain 使用日志链记录日志
file 使用文件方式记录日志
file 使用文件方式记录日志
fn 使用函数方式记录日志,函数由调用者提供
fn 使用函数方式记录日志,函数由调用者提供
syslog 方式记录日志
syslog 方式记录日志

Jump to

Keyboard shortcuts

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