mappers

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2018 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var FindExceptionsOnStacktrace = false

Tells if Sherlog should scan stacktrace for exceptions (may slow down performance)

View Source
var RegexpMappers = make(map[string]RegexpMapper)

Holds all regexp based mappers registered in Sherlog (used for parsing user configuration)

View Source
var RegisteredMappers = make(map[string]Mapper)

Holds all the mappers registered in Sherlog

Functions

func ParseYaml

func ParseYaml(filePath string) error

Parses the given yaml file and adds it to the RegexpMappers

Types

type Config

type Config struct {
	// Sets the base of this configuration to inherit its properties
	From string
	// Holds the entry pattern
	Entry string
	// Holds the exception pattern
	Exception string
	// Holds the stacktrace pattern
	Stacktrace string
}

Struct that represents a configuration for mapping log entries

type Mapper

type Mapper interface {

	// Maps all string from the input channel to an Entry structure and sends them to the pipeline channel
	Map(in <-chan *domain.Line, pipeline chan<- *domain.Entry)
}

Interface that defines a mapper Basically, a mapper is responsible for grabbing strings from a channel, mapping it to an Entry structure and passing it to the pipeline channel

type RegexpMapper

type RegexpMapper struct {

	// The pattern for the entry, the captured groups will be bound to the Entry object
	Entry *regexp.Regexp
	// The pattern for exception names
	Exception *regexp.Regexp
	// The pattern for the stacktrace, while this pattern occurs in subsequent inputs from the channel, the input will
	// be attached to the last entry as a stacktrace element
	Stacktrace *regexp.Regexp
}

Struct that defines a mapper that uses regular expression

var JavaMapper RegexpMapper

A Java mapper for use as a base

var WildflyMapper RegexpMapper

A mapper for Wildfly logs

func (RegexpMapper) Map

func (mapper RegexpMapper) Map(in <-chan *domain.Line, out chan<- *domain.Entry)

Implements the mapper interface by using the defined regular expressions against the input strings

Jump to

Keyboard shortcuts

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