Documentation
¶
Index ¶
- func Debug(source, format string, args ...interface{})
- func Error(source, format string, args ...interface{})
- func Info(source, format string, args ...interface{})
- func Warn(source, format string, args ...interface{})
- type LogEntry
- type LogLevel
- type RingBuffer
- func (rb *RingBuffer) Add(entry LogEntry)
- func (rb *RingBuffer) AddLog(level LogLevel, source, format string, args ...interface{})
- func (rb *RingBuffer) Clear()
- func (rb *RingBuffer) Debug(source, format string, args ...interface{})
- func (rb *RingBuffer) Error(source, format string, args ...interface{})
- func (rb *RingBuffer) GetAll() []LogEntry
- func (rb *RingBuffer) GetByLevel(levels ...LogLevel) []LogEntry
- func (rb *RingBuffer) GetLast(n int) []LogEntry
- func (rb *RingBuffer) Info(source, format string, args ...interface{})
- func (rb *RingBuffer) Warn(source, format string, args ...interface{})
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type LogEntry ¶
type LogEntry struct {
Timestamp time.Time `json:"timestamp"`
Level LogLevel `json:"level"`
Message string `json:"message"`
Source string `json:"source,omitempty"`
}
LogEntry represents a single log entry
type RingBuffer ¶
type RingBuffer struct {
// contains filtered or unexported fields
}
RingBuffer is a thread-safe circular buffer for log entries
func GetGlobalLogger ¶
func GetGlobalLogger() *RingBuffer
GetGlobalLogger returns the global logger instance
func NewRingBuffer ¶
func NewRingBuffer(size int) *RingBuffer
NewRingBuffer creates a new ring buffer with the specified capacity
func (*RingBuffer) Add ¶
func (rb *RingBuffer) Add(entry LogEntry)
Add appends a new log entry to the buffer
func (*RingBuffer) AddLog ¶
func (rb *RingBuffer) AddLog(level LogLevel, source, format string, args ...interface{})
AddLog is a convenience method to add a log with level and message
func (*RingBuffer) Debug ¶
func (rb *RingBuffer) Debug(source, format string, args ...interface{})
Debug logs a debug message
func (*RingBuffer) Error ¶
func (rb *RingBuffer) Error(source, format string, args ...interface{})
Error logs an error message
func (*RingBuffer) GetAll ¶
func (rb *RingBuffer) GetAll() []LogEntry
GetAll returns all log entries in chronological order
func (*RingBuffer) GetByLevel ¶
func (rb *RingBuffer) GetByLevel(levels ...LogLevel) []LogEntry
GetByLevel returns log entries filtered by level
func (*RingBuffer) GetLast ¶
func (rb *RingBuffer) GetLast(n int) []LogEntry
GetLast returns the last n log entries
func (*RingBuffer) Info ¶
func (rb *RingBuffer) Info(source, format string, args ...interface{})
Info logs an info message
func (*RingBuffer) Warn ¶
func (rb *RingBuffer) Warn(source, format string, args ...interface{})
Warn logs a warning message
Click to show internal directories.
Click to hide internal directories.