Files
logwisp/internal/source/source.go
T
lixen a63b512733
Package / arch (push) Canceled after 0s
Package / user (push) Canceled after 0s
Package / deb (push) Canceled after 0s
Package / freebsd (push) Canceled after 0s
Package / image (push) Canceled after 0s
Test / test (push) Canceled after 0s
Test / e2e (push) Canceled after 0s
v0.36.0 doc sweep update
2026-10-14 11:33:04 -04:00

43 lines
987 B
Go

package source
import (
"time"
"github.com/lixenwraith/logwisp/internal/core"
)
// Source represents an input data stream for log entries
type Source interface {
// Capabilities returns a slice of supported Source capabilities
Capabilities() []core.Capability
// Subscribe returns a channel that receives log entries from the source
Subscribe() <-chan core.LogEntry
// Start begins reading from the source
Start() error
// Stop gracefully shuts down the source
Stop()
// GetStats returns the source's statistics
GetStats() SourceStats
}
// SourceStats contains statistics about a source
type SourceStats struct {
ID string
Type string
TotalEntries uint64
DroppedEntries uint64
StartTime time.Time
LastEntryTime time.Time
Details map[string]any
}
// ExtractLogLevel returns the level the first word naming one marks, or ""
func ExtractLogLevel(line string) string {
level, _, _ := core.LevelWord(line, "")
return level
}