logparse

package
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 14, 2019 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseFrom

func ParseFrom(reader io.Reader, fileName, element string, entryConsumer func(LogEntry))

ParseFrom parses log lines from the reader.

2017-05-16T13:18:16.539536145+0000 [DBUG] Topology loaded topo= > Loc addrs: > 127.0.0.65:30066 > Interfaces: > IFID: 41 Link: CORE Local: 127.0.0.6:50000 Remote: 127.0.0.7:50000 IA: 1-ff00:0:312 2017-05-16T13:18:16.539658666+0000 [INFO] Starting up id=br1-ff00:0:311-1

Lines starting with "> " or a space are assumed to be continuations, i.e. they belong with the line(s) above them.

The fileName is used for logging. The element is put in LogEntry.Element. Parsed entries are passed to the entryConsumer.

Types

type LogEntry

type LogEntry struct {
	Timestamp time.Time
	// Element describes the source of this LogEntry, e.g. the file name.
	Element string
	Level   log.Lvl
	Lines   []string
}

LogEntry is one entry in a log.

func (LogEntry) String

func (l LogEntry) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL