internal

package
v2.6.5 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func String added in v2.3.2

func String(val any) string

Types

type Buffer

type Buffer interface {
	Bytes() []byte

	Release()
}

type Entity

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

type Format

type Format string

Format is the log output format.

const (
	FormatText Format = "text" // Text format
	FormatJson Format = "json" // JSON format
)

type Formatter

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

type JsonFormatter

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

func NewJsonFormatter

func NewJsonFormatter() *JsonFormatter

func (*JsonFormatter) Format

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

type Level

type Level string

Level is a log 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 returns the color of the log level.

func (Level) Label

func (l Level) Label() string

Label returns the four-letter label of the log level.

func (Level) Priority

func (l Level) Priority() int

Priority returns the priority of the log level.

type Syncer

type Syncer interface {
	// Name returns the syncer name.
	Name() string
	// Write writes the log entity.
	Write(entity *Entity) error
	// Close closes the syncer.
	Close() error
}

Syncer writes log entities to a destination.

type TextFormatter

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

func NewTextFormatter

func NewTextFormatter(isSupportColor ...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