internal

package
v2.4.2 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func String

func String(val any) string

Types

type Buffer

type Buffer interface {
	Bytes() []byte

	Release()
}

type Entity

type Entity struct {
	Now      time.Time
	Time     string
	Datetime string
	Level    Level
	Message  string
	Caller   string
	Frames   []runtime.Frame
}

type Format

type Format string

Format 日志输出格式

const (
	FormatText Format = "text" // 文本格式
	FormatJson Format = "json" // JSON格式
)

type Formatter

type Formatter interface {
	Format(entity *Entity) Buffer
}

type JsonFormatter

type JsonFormatter struct {
	// contains filtered or unexported fields
}

func NewJsonFormatter

func NewJsonFormatter(console ...bool) *JsonFormatter

func (*JsonFormatter) Format

func (f *JsonFormatter) Format(entity *Entity) Buffer

type Level

type Level string

Level 日志级别

const (
	LevelNone  Level = "none"  // NONE
	LevelDebug Level = "debug" // DEBUG
	LevelInfo  Level = "info"  // INFO
	LevelWarn  Level = "warn"  // WARN
	LevelError Level = "error" // ERROR
	LevelFatal Level = "fatal" // FATAL
	LevelPanic Level = "panic" // PANIC
)

func (Level) Color

func (l Level) Color() string

Color 获取日志级别颜色

func (Level) Label

func (l Level) Label() string

func (Level) Priority

func (l Level) Priority() int

Priority 获取日志级别优先级

type Syncer

type Syncer interface {
	// Name 同步器名称
	Name() string
	// Write 写入日志
	Write(entity *Entity) error
	// Close 关闭同步器
	Close() error
}

type TextFormatter

type TextFormatter struct {
	// contains filtered or unexported fields
}

func NewTextFormatter

func NewTextFormatter(console ...bool) *TextFormatter

func (*TextFormatter) Format

func (f *TextFormatter) Format(entity *Entity) Buffer

Jump to

Keyboard shortcuts

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