log

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	//ENV 环境变量前缀,默认空
	ENV = ""
)

Functions

This section is empty.

Types

type Level

type Level int

Level log level

var (

	//Info info level
	Info Level
	//Warn warn level
	Warn Level = 1
	//Error error level
	Error Level = 2
	//Fatal fatal level
	Fatal Level = 3
	//None disable log output
	None Level = 4
)

type Logger

type Logger interface {
	// Printf calls l.Output to print to the logger.
	// Arguments are handled in the manner of fmt.Printf.
	Printf(format string, v ...interface{})

	// Print calls l.Output to print to the logger.
	// Arguments are handled in the manner of fmt.Print.
	Print(v ...interface{})

	// Println calls l.Output to print to the logger.
	// Arguments are handled in the manner of fmt.Println.
	Println(v ...interface{})

	// Warnf calls l.Output to print to the logger.
	// Arguments are handled in the manner of fmt.Printf.
	Warnf(format string, v ...interface{})

	// Warn calls l.Output to print to the logger.
	// Arguments are handled in the manner of fmt.Print.
	Warn(v ...interface{})

	// Warnln calls l.Output to print to the logger.
	// Arguments are handled in the manner of fmt.Println.
	Warnln(v ...interface{})

	// Errorf calls l.Output to print to the logger.
	// Arguments are handled in the manner of fmt.Printf.
	Errorf(format string, v ...interface{})

	// Error calls l.Output to print to the logger.
	// Arguments are handled in the manner of fmt.Print.
	Error(v ...interface{})

	// Errorln calls l.Output to print to the logger.
	// Arguments are handled in the manner of fmt.Println.
	Errorln(v ...interface{})

	// Fatalf calls l.Output to print to the logger.
	// Arguments are handled in the manner of fmt.Printf.
	Fatalf(format string, v ...interface{})

	// Fatal calls l.Output to print to the logger.
	// Arguments are handled in the manner of fmt.Print.
	Fatal(v ...interface{})

	// Fatalln calls l.Output to print to the logger.
	// Arguments are handled in the manner of fmt.Println.
	Fatalln(v ...interface{})

	SetLevel(l Level)
	//OnMessageOutput 消息输出回调
	OnMessageOutput(func(msg string))
}

Logger provides a convenient interface for logging

func NewLogger

func NewLogger(name string) Logger

NewLogger create new named logger

Jump to

Keyboard shortcuts

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