Files
reproxy/examples/plugin/vendor/github.com/go-pkgz/lgr/mapper.go
Umputun 7139c57766 RPC plugins support (#85)
* wip

* resolve merge artifacts

* full coverage for conductor

* wire plugin conductor to main and proxy

* wip, with separate match handler

* split matching logic with another handler, add initial docs

* move parts of proxy to handlers, add tests

* add headers in to be sent to proxied url

* merged from master

* add example with docker compose

* supress excesive debug reporting 0-9 disabled in docker

* add plugin tests

* randomize test port

* lint: minor warns

* lint: err shadow
2021-06-01 02:56:39 -05:00

29 lines
1.1 KiB
Go

package lgr
// Mapper defines optional functions to change elements of the logged message for each part, based on levels.
// Only some mapFunc can be defined, by default does nothing. Can be used to alter the output, for example making some
// part of the output colorful.
type Mapper struct {
MessageFunc mapFunc // message mapper on all levels
ErrorFunc mapFunc // message mapper on ERROR level
WarnFunc mapFunc // message mapper on WARN level
InfoFunc mapFunc // message mapper on INFO level
DebugFunc mapFunc // message mapper on DEBUG level
CallerFunc mapFunc // caller mapper, all levels
TimeFunc mapFunc // time mapper, all levels
}
type mapFunc func(string) string
// nopMapper is a default, doing nothing
var nopMapper = Mapper{
MessageFunc: func(s string) string { return s },
ErrorFunc: func(s string) string { return s },
WarnFunc: func(s string) string { return s },
InfoFunc: func(s string) string { return s },
DebugFunc: func(s string) string { return s },
CallerFunc: func(s string) string { return s },
TimeFunc: func(s string) string { return s },
}