config

package
v0.0.0-...-584518c Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var PredefinedTimeLayouts map[string]string = map[string]string{
	"ANSIC":       time.ANSIC,
	"UnixDate":    time.UnixDate,
	"RubyDate":    time.RubyDate,
	"RFC822":      time.RFC822,
	"RFC822Z":     time.RFC822Z,
	"RFC850":      time.RFC850,
	"RFC1123":     time.RFC1123,
	"RFC1123Z":    time.RFC1123Z,
	"RFC3339":     time.RFC3339,
	"RFC3339Nano": time.RFC3339Nano,
	"Kitchen":     time.Kitchen,
	"":            time.Stamp,
	"Stamp":       time.Stamp,
	"StampMilli":  time.StampMilli,
	"StampMicro":  time.StampMicro,
	"StampNano":   time.StampNano,
}
View Source
var PredicateTimeLayout string = time.RFC3339

Functions

This section is empty.

Types

type GowatchConfig

type GowatchConfig struct {
	Logfiles []LogfileConfig
	Summary  []SummaryConfig
}

Gowatch's Configuration will be marshalled and unmarshalled into/from this datastructure. Note that we don't use pointers here, as their contents will not be compared in deep equals, and therefore they are harder to use in tests etc.

func ReadConfigByFilename

func ReadConfigByFilename(filename string) *GowatchConfig

func ReadConfigFromBytes

func ReadConfigFromBytes(contents []byte) *GowatchConfig

type LogfileConfig

type LogfileConfig struct {
	Filename string
	// Tags that will be appended to each logline
	Tags   []string
	Parser string
	// Configures the parser
	With map[interface{}]interface{}
	// Predicates that can filter the lines being processed by gowatch
	Where PredicateConfig
	// A layout providing the reference time, as described in Go's time.Parse function. Also see the predefined layouts
	// in the PredefinedTimeLayouts variable.
	TimeLayout string
}

Configures a logfile whose lines shall be parsed and processed by gowatch

func (*LogfileConfig) CreateParser

func (logfile *LogfileConfig) CreateParser(linesource parser.LineSource, predicate logentry.Predicate) parser.Parser

type PredicateConfig

type PredicateConfig map[string]interface{}

This structure allows to express conditions on logentry.LogEntry in configuration files. It is not made for internal use, but solely for unmarshalling users configuration. Keys are either names of LogEntry fields, or the special values "not", "allof", "anyof" or "noneof".

func (PredicateConfig) CreatePredicate

func (config PredicateConfig) CreatePredicate() logentry.Predicate

type SummaryConfig

type SummaryConfig struct {
	// Determines the type of summary
	Do    string
	Title string
	// Configures the summary
	With map[interface{}]interface{}
	// Prediactes that filter the lines to be considered in this summary
	Where PredicateConfig
}

Configures one summary

func (*SummaryConfig) CreateSummarizer

func (summaryConfig *SummaryConfig) CreateSummarizer() summary.Summarizer

Jump to

Keyboard shortcuts

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