Documentation
¶
Index ¶
- Constants
- func AppendWithTime(ts time.Time, level, source, message string)
- func ClearBuffer()
- func Debug(format string, args ...any)
- func Debugf(ctx context.Context, format string, args ...any)
- func Error(format string, args ...any)
- func Errorf(ctx context.Context, format string, args ...any)
- func Fatalf(ctx context.Context, format string, args ...any)
- func GetLevel() string
- func Info(format string, args ...any)
- func Infof(ctx context.Context, format string, args ...any)
- func SetLevel(name string) bool
- func Warn(format string, args ...any)
- func Warnf(ctx context.Context, format string, args ...any)
- type Entry
- type Filter
Constants ¶
const ( // KindBackend keeps entries whose source does not start with "frontend". KindBackend = "backend" // KindFrontend keeps entries whose source starts with "frontend". KindFrontend = "frontend" )
Variables ¶
This section is empty.
Functions ¶
func AppendWithTime ¶
AppendWithTime records an externally supplied message while preserving the caller's timestamp. Used when replaying frontend logs whose clock may lead or lag the server. Used when replaying frontend logs whose clock may lead/lag the server.
Types ¶
type Entry ¶
type Entry struct {
ID uint64 `json:"id"`
Timestamp time.Time `json:"timestamp"`
Level string `json:"level"`
Source string `json:"source"`
Message string `json:"message"`
}
Entry is a single log record captured by the in-memory ring buffer. It is exposed through the /api/v1/logs endpoint so the settings UI can show recent backend logs without having to tail stdout.
func RecentEntries ¶
RecentEntries is the package-level accessor used by HTTP handlers.
type Filter ¶
type Filter struct {
MinLevel string
Kind string
Sources []string
Since uint64
Limit int
Keyword string
}
Filter narrows a RecentEntries query. A zero-value Filter returns everything the buffer still holds (newest first).
Kind partitions entries into the high-level "backend" / "frontend" buckets the settings UI exposes. Frontend entries are tagged with a "frontend" source prefix by the /api/v1/logs/frontend handler; everything else is treated as backend. Use Sources for exact-match component filtering.