core

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2023 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Executor

type Executor interface {
	Debug(msg string, fields ...gox.Field[any])

	Info(msg string, fields ...gox.Field[any])

	Warn(msg string, fields ...gox.Field[any])

	Error(msg string, fields ...gox.Field[any])

	Panic(msg string, fields ...gox.Field[any])

	Fatal(msg string, fields ...gox.Field[any])

	Sync() error
}

type Level

type Level string
const (
	LevelDebug Level = "debug"
	LevelInfo  Level = "info"
	LevelWarn  Level = "warn"
	LevelError Level = "error"
	LevelPanic Level = "panic"
	LevelFatal Level = "fatal"
)

func ParseLevel

func ParseLevel(level string) (lvl Level)

func (Level) Rank

func (l Level) Rank() (rank int)

type Logger

type Logger interface {
	// Level 现在的日志等级
	Level() Level

	// Enable 开启日志级别
	Enable(lvl Level)

	// Enabled 日志等级是否开启
	Enabled(lvl Level) bool

	// Debug 记录调试日志
	Debug(msg string, fields ...gox.Field[any])

	// Info 记录普通信息日志
	Info(msg string, fields ...gox.Field[any])

	// Warn 记录警告日志
	Warn(msg string, fields ...gox.Field[any])

	// Error 记录错误日志
	Error(msg string, fields ...gox.Field[any])

	// Panic 记录异常日志,程序会退出,可以使用recover机制来阻止程序退出
	Panic(msg string, fields ...gox.Field[any])

	// Fatal 记录致命错误日志,程序会退出
	Fatal(msg string, fields ...gox.Field[any])

	// Sync 同步
	Sync() error
}

Logger 日志接口

type Writer

type Writer string

func Stderr

func Stderr() Writer

Stderr 标准错误流

func Stdout

func Stdout() Writer

Stdout 标准输出流

Jump to

Keyboard shortcuts

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