Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type LogScope ¶
type LogScope struct {
// contains filtered or unexported fields
}
LogScope provides a scoped logger with memory buffering and optional forwarding to a parent logger. It creates an isolated logging environment that can capture log entries in memory while optionally forwarding them to a parent logger with inherited fields.
func NewLogger ¶
func NewLogger(options *ScopeOptions) *LogScope
NewLogger creates a new LogScope with the specified options. If no options are provided, defaults to a buffer size of 100 entries. The logger discards output by default and relies on hooks for processing.
func (*LogScope) Flush ¶
func (ls *LogScope) Flush()
Flush is a no-op method provided for interface compatibility. The LogScope uses hooks for immediate processing, so no flushing is needed.
func (*LogScope) GetLogEntries ¶
GetLogEntries retrieves log entries from the memory buffer with optional filtering. The from parameter filters entries to those after the specified time (exclusive). The limit parameter restricts the number of returned entries (0 = no limit). Returns entries in chronological order, with older entries first.
func (*LogScope) GetLogEntryCount ¶
GetLogEntryCount returns the total number of log entries processed by this scope. This includes entries that may have been rotated out of the memory buffer.
type ScopeOptions ¶
type ScopeOptions struct {
Parent logrus.FieldLogger // Parent logger to forward entries to (optional)
BufferSize uint64 // Maximum number of log entries to buffer in memory
}
ScopeOptions defines configuration for creating a LogScope instance. It specifies the parent logger for forwarding and buffer size for memory storage.