logger

package
v1.0.10 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2021 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ERROR = 31
	INFO  = 36
	PANIC = 35
)

基于ansi的终端颜色

View Source
const BG = ""
View Source
const FG = ""
View Source
const Fmt = "[\x1b[0;%dm%s\x1b[0m] %s\n"

Variables

This section is empty.

Functions

func PrintLogo()

Types

type Logger

type Logger struct {
	// os.stdout
	Writer io.Writer
	// error || info
	Level string
}

Logger 默认只提供到终端的日志记录器 如果需要使用其他方式 请使用multiwriter

var BlogLogger Logger

func InitLogger

func InitLogger(p string) Logger

InitLogger 因为配置文件在日志器后面初始化所以不使用全局的配置

func (*Logger) ErrorF

func (l *Logger) ErrorF(s string, args ...interface{})

ErrorF 错误记录 所有日志默认都带换行

func (*Logger) InfoF

func (l *Logger) InfoF(s string, args ...interface{})

InfoF 提示信息

func (*Logger) PanicF

func (l *Logger) PanicF(s string, args ...interface{})

PanicF 异常退出 会直接导致程序退出 谨慎使用除非遇到必须退出的任务

Jump to

Keyboard shortcuts

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