logger

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2022 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LoggerLevelAll int = iota
	LoggerLevelTrace
	LoggerLevelDebug
	LoggerLevelInfo
	LoggerLevelWarn
	LoggerLevelError
	LoggerLevelFatal
	LoggerLevelOff
)

日志颜色分类 绿色、蓝色、白色、黄色、红色、紫红色

Variables

View Source
var (
	SetLoggerLevel = logger.SetLoggerLevel
	SetOutput      = logger.SetOutput

	Trace  = logger.Trace
	Tracef = logger.Tracef
	Debug  = logger.Debug
	Debugf = logger.Debugf
	Info   = logger.Info
	Infof  = logger.Infof
	Warn   = logger.Warn
	Warnf  = logger.Warnf
	Error  = logger.Error
	Errorf = logger.Errorf
	Fatal  = logger.Fatal
	Fatalf = logger.Fatalf
	Print  = logger.Print
	Printf = logger.Printf
)

Functions

This section is empty.

Types

type LevelItem

type LevelItem struct {
	Color int
	Desc  string
}

等级设置

type Logger

type Logger struct {
	Output *os.File
	Level  int
}

func NewLogger

func NewLogger() *Logger

func (*Logger) Debug

func (l *Logger) Debug(v ...interface{})

调试

func (*Logger) Debugf

func (l *Logger) Debugf(format string, v ...interface{})

func (*Logger) Error

func (l *Logger) Error(v ...interface{})

报错

func (*Logger) Errorf

func (l *Logger) Errorf(format string, v ...interface{})

func (*Logger) Fatal

func (l *Logger) Fatal(v ...interface{})

强制退出

func (*Logger) Fatalf

func (l *Logger) Fatalf(format string, v ...interface{})

func (*Logger) Info

func (l *Logger) Info(v ...interface{})

警告

func (*Logger) Infof

func (l *Logger) Infof(format string, v ...interface{})

func (*Logger) Print

func (l *Logger) Print(v ...interface{})

打印

func (*Logger) Printf

func (l *Logger) Printf(format string, v ...interface{})

func (*Logger) SetLoggerLevel

func (l *Logger) SetLoggerLevel(level int)

设置日志等级

func (*Logger) SetOutput

func (l *Logger) SetOutput(output *os.File)

设置输出目标

func (*Logger) Trace

func (l *Logger) Trace(v ...interface{})

追踪

func (*Logger) Tracef

func (l *Logger) Tracef(format string, v ...interface{})

func (*Logger) Warn

func (l *Logger) Warn(v ...interface{})

警告

func (*Logger) Warnf

func (l *Logger) Warnf(format string, v ...interface{})

Jump to

Keyboard shortcuts

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