logger

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InferCategoryFromCaller added in v0.0.7

func InferCategoryFromCaller(file string) string

InferCategoryFromCaller maps source file paths to stable log categories.

func InitLogger

func InitLogger(logLevel string, logFile string, broadcaster *LogBroadcaster) (*zap.Logger, error)

InitLogger initializes the global logger

Types

type AsyncRotateWriter

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

AsyncRotateWriter implements io.Writer with async, batch, and drop capabilities

func NewAsyncRotateWriter

func NewAsyncRotateWriter(filename string, maxSizeMB int, buffer int) *AsyncRotateWriter

NewAsyncRotateWriter creates a new AsyncRotateWriter

func (*AsyncRotateWriter) Close

func (w *AsyncRotateWriter) Close() error

Close closes the writer

func (*AsyncRotateWriter) Stats

func (w *AsyncRotateWriter) Stats() uint64

Stats returns the number of dropped logs

func (*AsyncRotateWriter) Write

func (w *AsyncRotateWriter) Write(p []byte) (int, error)

Write implements io.Writer (non-blocking, can drop)

type LogBroadcaster

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

LogBroadcaster handles broadcasting log messages to WebSocket subscribers

func NewLogBroadcaster

func NewLogBroadcaster() *LogBroadcaster

func (*LogBroadcaster) Subscribe

func (b *LogBroadcaster) Subscribe() chan []byte

func (*LogBroadcaster) Unsubscribe

func (b *LogBroadcaster) Unsubscribe(ch chan []byte)

func (*LogBroadcaster) Write

func (b *LogBroadcaster) Write(p []byte) (n int, err error)

Write implements io.Writer to broadcast logs

Jump to

Keyboard shortcuts

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