mylog

package
v1.8.7 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2024 License: BSD-3-Clause Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ShowStyleDefault    uint = 0 //终端默认设置
	ShowStyleHighLight  uint = 1 //高亮显示
	ShowStyleUunderline uint = 4 //使用下划线
	ShowStyleFlashing   uint = 5 //闪烁
	ShowStyleAntiWhite  uint = 7 //反白显示
	ShowStyleInvisible  uint = 8 //不可见
)
View Source
const (
	FmtEmptySeparate = ""
)

Variables

This section is empty.

Functions

func Debug

func Debug(args ...interface{})

std logger

func Debugf

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

func Error

func Error(args ...interface{})

func Errorf

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

func Fatal

func Fatal(args ...interface{})

func Fatalf

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

func Info

func Info(args ...interface{})

func Infof

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

func InitDebugLevel

func InitDebugLevel(en bool) *logger

func InitErrorLevel

func InitErrorLevel(en bool) *logger

func InitFatalLevel

func InitFatalLevel(en bool) *logger

func InitInfoLevel

func InitInfoLevel(en bool) *logger

func InitPanicLevel

func InitPanicLevel(en bool) *logger

func InitWarnLevel

func InitWarnLevel(en bool) *logger

func New

func New(opts ...Option) *logger

func Panic

func Panic(args ...interface{})

func Panicf

func Panicf(format string, args ...interface{})

func SetOptions

func SetOptions(opts ...Option)

func StdLogger

func StdLogger() *logger

func Warn

func Warn(args ...interface{})

func Warnf

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

Types

type Color

type Color int
const (
	FgBlack Color = iota + 30
	FgRed
	FgGreen
	FgYellow
	FgMagenta
	FgCyan
	FgWhite
)

定义字体 颜色

type Entry

type Entry struct {
	Buffer *bytes.Buffer
	Map    map[string]any
	Level  Level
	Time   time.Time
	File   string
	Line   int
	Func   string
	Format string
	Args   []any
	// contains filtered or unexported fields
}

type Formatter

type Formatter interface {
	Format(entry *Entry) error
}

type JsonFormatter

type JsonFormatter struct {
	IgnoreBasicFields bool
}

func (*JsonFormatter) Format

func (f *JsonFormatter) Format(e *Entry) error

type Level

type Level uint8
const (
	DebugLevel Level = iota
	InfoLevel
	WarnLevel
	ErrorLevel
	PanicLevel
	FatalLevel
)

func (*Level) UnmarshalText

func (l *Level) UnmarshalText(text []byte) error

type Option

type Option func(*options)

func WithDisableCaller

func WithDisableCaller(caller bool) Option

func WithFormatter

func WithFormatter(formatter Formatter) Option

func WithLevel

func WithLevel(level Level, en bool) Option

func WithOutput

func WithOutput(output io.Writer) Option

func WithStdLevel

func WithStdLevel(level Level) Option

type TextFormatter

type TextFormatter struct {
	IgnoreBasicFields bool
}

func (*TextFormatter) Format

func (f *TextFormatter) Format(e *Entry) error

Jump to

Keyboard shortcuts

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