Documentation
¶
Index ¶
- type LogEntry
- type MockLogger
- func (m *MockLogger) CountEntries(level string) int
- func (m *MockLogger) Debug(msg string, keysAndValues ...any)
- func (m *MockLogger) Error(msg string, keysAndValues ...any)
- func (m *MockLogger) Fatal(msg string, keysAndValues ...any)
- func (m *MockLogger) GetEntries() []LogEntry
- func (m *MockLogger) HasEntry(level, message string) bool
- func (m *MockLogger) Info(msg string, keysAndValues ...any)
- func (m *MockLogger) LastEntry() *LogEntry
- func (m *MockLogger) Reset()
- func (m *MockLogger) String() string
- func (m *MockLogger) Trace(msg string, keysAndValues ...any)
- func (m *MockLogger) Warn(msg string, keysAndValues ...any)
- func (m *MockLogger) With(key string, value any) logger.Logger
- func (m *MockLogger) WithError(err error) logger.Logger
- func (m *MockLogger) WithGroup(group string) logger.Logger
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type LogEntry ¶
type LogEntry struct {
Level string
Message string
KeysAndValues []any
Attrs map[string]any
Group string
}
LogEntry represents a single log entry
type MockLogger ¶
type MockLogger struct {
Entries []LogEntry
// contains filtered or unexported fields
}
MockLogger is a logger implementation that captures log calls for testing
func (*MockLogger) CountEntries ¶
func (m *MockLogger) CountEntries(level string) int
CountEntries returns the number of log entries with the given level
func (*MockLogger) Debug ¶
func (m *MockLogger) Debug(msg string, keysAndValues ...any)
func (*MockLogger) Error ¶
func (m *MockLogger) Error(msg string, keysAndValues ...any)
func (*MockLogger) Fatal ¶ added in v0.2.0
func (m *MockLogger) Fatal(msg string, keysAndValues ...any)
func (*MockLogger) GetEntries ¶
func (m *MockLogger) GetEntries() []LogEntry
GetEntries returns a copy of all log entries (thread-safe)
func (*MockLogger) HasEntry ¶
func (m *MockLogger) HasEntry(level, message string) bool
HasEntry checks if an entry with the given level and message exists
func (*MockLogger) Info ¶
func (m *MockLogger) Info(msg string, keysAndValues ...any)
func (*MockLogger) LastEntry ¶
func (m *MockLogger) LastEntry() *LogEntry
LastEntry returns the last log entry, or nil if no entries
func (*MockLogger) String ¶
func (m *MockLogger) String() string
String returns a human-readable representation of all log entries
func (*MockLogger) Trace ¶
func (m *MockLogger) Trace(msg string, keysAndValues ...any)
func (*MockLogger) Warn ¶
func (m *MockLogger) Warn(msg string, keysAndValues ...any)
Click to show internal directories.
Click to hide internal directories.