Documentation
¶
Index ¶
Constants ¶
const (
ErrFileTruncated semerr.Error = "file truncated"
)
const ( // RefreshInterval is an interval of refreshing logs. RefreshInterval = 200 * time.Millisecond )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type LazyLogEntries ¶ added in v0.4.0
type LazyLogEntries struct { Seeker *os.File Entries []LazyLogEntry }
LazyLogEntries is a helper type definition for the slice of lazy log entries.
func (LazyLogEntries) Filter ¶ added in v0.4.0
func (entries LazyLogEntries) Filter(term string) (LazyLogEntries, error)
Filter filters entries by ignore case exact match.
func (LazyLogEntries) Len ¶ added in v1.0.0
func (entries LazyLogEntries) Len() int
type LazyLogEntry ¶ added in v0.4.0
type LazyLogEntry struct {
// contains filtered or unexported fields
}
LazyLogEntry holds unredenred LogEntry. Use `LogEntry` getter.
func (LazyLogEntry) Length ¶ added in v1.0.0
func (e LazyLogEntry) Length() int
Length of the entry.
func (LazyLogEntry) Line ¶ added in v0.4.0
func (e LazyLogEntry) Line(file *os.File) (json.RawMessage, error)
Line re-reads the line.
type Level ¶
type Level string
Level of the logs entity.
const ( LevelUnknown Level = "none" LevelTrace Level = "trace" LevelDebug Level = "debug" LevelInfo Level = "info" LevelWarning Level = "warn" LevelError Level = "error" LevelPanic Level = "panic" LevelFatal Level = "fatal" )
Possible log levels.
func ParseLevel ¶ added in v0.1.1
ParseLevel parses level from the text value.
nolint: cyclop // Switch-case.
type LogEntry ¶
type LogEntry struct { Fields []string Line json.RawMessage Error error }
LogEntry is a single partly-parse record of the log.
type Source ¶ added in v1.0.0
type Source struct { // Seeker is used to do random access reads from the file. Seeker *os.File // contains filtered or unexported fields }
func Reader ¶ added in v1.0.0
Reader creates a new Source for reading log entries from an io.Reader. This will write the input to a temp file, which will be used to seek against.
func (*Source) Close ¶ added in v1.0.0
Close implements io.Closer.
It closes and removes temporary files.
func (*Source) ParseLogEntries ¶ added in v1.0.0
func (s *Source) ParseLogEntries() (LazyLogEntries, error)
func (*Source) StartStreaming ¶ added in v1.0.0
func (s *Source) StartStreaming(ctx context.Context, send func(msg LazyLogEntries, err error))
StartStreaming synchronizes log entries with the file and sends them to the channel.