common

package
v1.4.67 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	InternalLevel      log.Level = log.ErrorLevel
	InternalTimeFormat string    = "15:04:05.000" // Console logger, should not need the date!
)

Functions

func IsEmpty

func IsEmpty(input string) bool

func LevelStringTo3Letter added in v1.4.61

func LevelStringTo3Letter(level string) string

LevelStringTo3Letter converts a string log level (e.g. "info", "warning") to a 3-letter uppercase string.

func LevelTo3Letter added in v1.4.61

func LevelTo3Letter(level log.Level) string

LevelTo3Letter converts a phuslu log.Level to a 3-letter uppercase string.

func Log added in v1.4.48

func Log(event models.LogEvent)

Log adds a log event to the buffer.

func NewLogger added in v1.4.31

func NewLogger() *logger

func Start added in v1.4.48

func Start(out chan []models.LogEvent, size int, interval time.Duration)

Start initializes and starts the context log buffer. It should only be called once.

func Stop added in v1.4.48

func Stop()

Stop signals the buffer to flush any remaining logs and stop.

Types

type ChannelBuffer added in v1.4.52

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

ChannelBuffer provides per-instance batching for log events sent to a channel. Unlike contextbuffer.go which is a singleton, this allows multiple independent buffers.

func NewChannelBuffer added in v1.4.52

func NewChannelBuffer(out chan []models.LogEvent, size int, interval time.Duration) *ChannelBuffer

NewChannelBuffer creates and starts a new channel buffer instance. Returns nil if the output channel is nil.

func (*ChannelBuffer) Log added in v1.4.52

func (cb *ChannelBuffer) Log(event models.LogEvent)

Log adds a log event to the buffer.

func (*ChannelBuffer) Stop added in v1.4.52

func (cb *ChannelBuffer) Stop()

Stop signals the buffer to flush any remaining logs and stop.

Jump to

Keyboard shortcuts

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