mlog

package
v0.0.0-...-51fbea3 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewMultiFileWriter

func NewMultiFileWriter() (writer, error)

func ReadConfig

func ReadConfig() (*fileWriterConfig, *viper.Viper, error)

Types

type Level

type Level uint8
const (
	DebugLevel Level = iota + 1
	InfoLevel
	WarnLevel
	ErrorLevel
	PanicLevel
	NaN
)

func ParseLevel

func ParseLevel(levelStr string) (lvl Level)

ParseLevel 给定描述日志等级的字符串,返回其对应的 Level。

func (Level) ColorString

func (l Level) ColorString() (levelStr string)

func (Level) String

func (l Level) String() (levelStr string)

String 返回描述日志等级的 Level 的小写字符串形式。

type Logger

type Logger interface {
	Debug(args ...any)
	Debugf(format string, args ...interface{})
	Info(args ...any)
	Infof(format string, args ...interface{})
	Warn(args ...any)
	Warnf(format string, args ...interface{})
	Error(args ...any)
	Errorf(format string, args ...interface{})
	Panic(args ...any)
	Panicf(format string, args ...interface{})
	With(key, value string) Logger
	Stop() error
	ChangeLevel(lvl Level)
}

func GetLogger

func GetLogger(module string, lvl Level, printPath ...bool) Logger

func GetTestLogger

func GetTestLogger(module string, lvl Level, printPath ...bool) Logger

Jump to

Keyboard shortcuts

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