log

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2022 License: MIT Imports: 7 Imported by: 15

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Debug

func Debug(a ...interface{})

Debug 打印调试日志

func Debugf

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

Debugf 打印调试模板日志

func Error

func Error(a ...interface{})

Error 打印错误日志

func Errorf

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

Errorf 打印错误模板日志

func Fatal

func Fatal(a ...interface{})

Fatal 打印致命错误日志

func Fatalf

func Fatalf(format string, a ...interface{})

Fatalf 打印致命错误模板日志

func Info

func Info(a ...interface{})

Info 打印信息日志

func Infof

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

Infof 打印信息模板日志

func SetLogger

func SetLogger(logger Logger)

SetLogger 设置日志记录器

func Warn

func Warn(a ...interface{})

Warn 打印警告日志

func Warnf

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

Warnf 打印警告模板日志

Types

type Level

type Level int
const (
	LevelInfo  Level = iota + 1 // INFO
	LevelDebug                  // DEBUG
	LevelWarn                   // WARN
	LevelError                  // ERROR
	LevelFatal                  // FATAL
)

func (Level) String

func (i Level) String() string

type Logger

type Logger interface {
	// Info 打印信息日志
	Info(a ...interface{})
	// Infof 打印信息模板日志
	Infof(format string, a ...interface{})
	// Debug 打印调试日志
	Debug(a ...interface{})
	// Debugf 打印调试模板日志
	Debugf(format string, a ...interface{})
	// Warn 打印警告日志
	Warn(a ...interface{})
	// Warnf 打印警告模板日志
	Warnf(format string, a ...interface{})
	// Error 打印错误日志
	Error(a ...interface{})
	// Errorf 打印错误模板日志
	Errorf(format string, a ...interface{})
	// Fatal 打印致命错误日志
	Fatal(a ...interface{})
	// Fatalf 打印致命错误模板日志
	Fatalf(format string, a ...interface{})
}

func GetLogger

func GetLogger() Logger

GetLogger 获取日志记录器

func NewLogger

func NewLogger(opts ...Option) Logger

type Option

type Option func(o *options)

func WithFlag

func WithFlag(flag int) Option

func WithPrefix

func WithPrefix(prefix string) Option

func WithWriter

func WithWriter(writer io.Writer) Option

Directories

Path Synopsis
aliyun module
logrus module
tencent module
zap module

Jump to

Keyboard shortcuts

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