logger

package
v0.0.0-...-706b979 Latest Latest
Warning

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

Go to latest
Published: May 4, 2026 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Get

func Get(component string) zerolog.Logger

Get returns a logger with the given component name

func Setup

func Setup(level, format string)

Setup initializes the global logger with log buffer capture

Types

type LogBuffer

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

LogBuffer is a circular buffer that stores recent log entries

func GetBuffer

func GetBuffer() *LogBuffer

GetBuffer returns the global log buffer instance

func NewLogBuffer

func NewLogBuffer(size int) *LogBuffer

NewLogBuffer creates a new log buffer with specified capacity

func (*LogBuffer) Add

func (b *LogBuffer) Add(entry LogEntry)

Add adds a log entry to the buffer

func (*LogBuffer) Count

func (b *LogBuffer) Count() int

Count returns the current number of entries in the buffer

func (*LogBuffer) GetRecent

func (b *LogBuffer) GetRecent(limit int, level string, sinceMinutes int) []LogEntry

GetRecent returns the most recent log entries

type LogBufferWriter

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

LogBufferWriter is an io.Writer that captures log output and stores in buffer

func NewLogBufferWriter

func NewLogBufferWriter(original io.Writer) *LogBufferWriter

NewLogBufferWriter creates a writer that captures logs to buffer

func (*LogBufferWriter) Write

func (w *LogBufferWriter) Write(p []byte) (n int, err error)

Write implements io.Writer, parsing zerolog JSON and storing entries

type LogEntry

type LogEntry struct {
	Timestamp time.Time `json:"timestamp"`
	Level     string    `json:"level"`
	Component string    `json:"component,omitempty"`
	Message   string    `json:"message"`
	Caller    string    `json:"caller,omitempty"`
}

LogEntry represents a single log entry

Jump to

Keyboard shortcuts

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