Documentation ¶
Index ¶
- Constants
- func BuildFilterPredicate(filterConfig *FilterConfig) (func([]interface{}) bool, error)
- func BuildKeyValuesPredicate(kvpConfigs []*KeyValuePredicateConfig, matchAll bool) (func([]interface{}) bool, error)
- func BuildLoggerFromSinkConfig(sinkConfig *SinkConfig, captures map[string]*loggers.CaptureLogger) (log.Logger, map[string]*loggers.CaptureLogger, error)
- func BuildOutputLogger(outputConfig *OutputConfig) (log.Logger, error)
- func BuildTransformLogger(transformConfig *TransformConfig, captures map[string]*loggers.CaptureLogger, ...) (log.Logger, map[string]*loggers.CaptureLogger, error)
- func BuildTransformLoggerPassthrough(transformConfig *TransformConfig, captures map[string]*loggers.CaptureLogger, ...) (log.Logger, map[string]*loggers.CaptureLogger, error)
- func JSONString(v interface{}) string
- func TOMLString(v interface{}) string
- type CaptureConfig
- type FileConfig
- type FilterConfig
- type KeyValuePredicateConfig
- type LabelConfig
- type LoggingConfig
- func (lc *LoggingConfig) JSONString() string
- func (lc *LoggingConfig) Logger() (*logging.Logger, error)
- func (lc *LoggingConfig) MustLogger() *logging.Logger
- func (lc *LoggingConfig) None() *LoggingConfig
- func (lc *LoggingConfig) Root(configure func(sink *SinkConfig) *SinkConfig) *LoggingConfig
- func (lc *LoggingConfig) RootJSONString() string
- func (lc *LoggingConfig) RootTOMLString() string
- func (lc *LoggingConfig) TOMLString() string
- func (lc *LoggingConfig) UpdateLogger(logger *logging.Logger) (channels.Channel, error)
- func (lc *LoggingConfig) WithTrace() *LoggingConfig
- type LoggingConfigWrapper
- type OutputConfig
- type PruneConfig
- type SinkConfig
- func (sc *SinkConfig) AddSinks(sinks ...*SinkConfig) *SinkConfig
- func (sc *SinkConfig) BuildLogger() (log.Logger, map[string]*loggers.CaptureLogger, error)
- func (sc *SinkConfig) FilterScope(scope string) *SinkConfig
- func (sc *SinkConfig) Logger() (*logging.Logger, error)
- func (sc *SinkConfig) LoggingConfig() *LoggingConfig
- func (sc *SinkConfig) MustLogger() *logging.Logger
- func (sc *SinkConfig) SetOutput(output *OutputConfig) *SinkConfig
- func (sc *SinkConfig) SetTransform(transform *TransformConfig) *SinkConfig
- func (sc *SinkConfig) Terminal() *SinkConfig
- type SortConfig
- type SyslogConfig
- type TransformConfig
- func CaptureTransform(name string, bufferCap int, passthrough bool) *TransformConfig
- func FilterTransform(fmode filterMode, keyValueRegexes ...string) *TransformConfig
- func LabelTransform(prefix bool, labelKeyvals ...string) *TransformConfig
- func OnlyTransform(keys ...string) *TransformConfig
- func PruneTransform(keys ...string) *TransformConfig
- func SortTransform(keys ...string) *TransformConfig
- func VectoriseTransform() *TransformConfig
Constants ¶
const ( JSONFormat = loggers.JSONFormat LogfmtFormat = loggers.LogfmtFormat TerminalFormat = loggers.TerminalFormat DefaultFormat = loggers.DefaultFormat )
Keep these in sync
const ( // OutputType NoOutput outputType = "" Stdout outputType = "stdout" Stderr outputType = "stderr" File outputType = "file" // TransformType NoTransform transformType = "" // Filter log lines Filter transformType = "filter" // Remove key-val pairs from each log line Prune transformType = "prune" // Add key value pairs to each log line Label transformType = "label" Capture transformType = "capture" Sort transformType = "sort" Vectorise transformType = "vectorise" NoFilterMode filterMode = "" IncludeWhenAllMatch filterMode = "include_when_all_match" IncludeWhenAnyMatches filterMode = "include_when_any_match" ExcludeWhenAllMatch filterMode = "exclude_when_all_match" ExcludeWhenAnyMatches filterMode = "exclude_when_any_match" )
Variables ¶
This section is empty.
Functions ¶
func BuildFilterPredicate ¶
func BuildFilterPredicate(filterConfig *FilterConfig) (func([]interface{}) bool, error)
func BuildKeyValuesPredicate ¶
func BuildKeyValuesPredicate(kvpConfigs []*KeyValuePredicateConfig, matchAll bool) (func([]interface{}) bool, error)
func BuildLoggerFromSinkConfig ¶
func BuildLoggerFromSinkConfig(sinkConfig *SinkConfig, captures map[string]*loggers.CaptureLogger) (log.Logger, map[string]*loggers.CaptureLogger, error)
func BuildOutputLogger ¶
func BuildOutputLogger(outputConfig *OutputConfig) (log.Logger, error)
func BuildTransformLogger ¶
func BuildTransformLogger(transformConfig *TransformConfig, captures map[string]*loggers.CaptureLogger, outputLogger log.Logger) (log.Logger, map[string]*loggers.CaptureLogger, error)
func BuildTransformLoggerPassthrough ¶
func BuildTransformLoggerPassthrough(transformConfig *TransformConfig, captures map[string]*loggers.CaptureLogger, outputLogger log.Logger) (log.Logger, map[string]*loggers.CaptureLogger, error)
func JSONString ¶
func JSONString(v interface{}) string
func TOMLString ¶
func TOMLString(v interface{}) string
Types ¶
type CaptureConfig ¶
Sink configuration types
type FilterConfig ¶
type FilterConfig struct { FilterMode filterMode // Predicates to match a log line against using FilterMode Predicates []*KeyValuePredicateConfig }
Filter types
func (*FilterConfig) AddPredicate ¶
func (filterConfig *FilterConfig) AddPredicate(keyRegex, valueRegex string) *FilterConfig
func (*FilterConfig) SetFilterMode ¶
func (filterConfig *FilterConfig) SetFilterMode(filterMode filterMode) *FilterConfig
type KeyValuePredicateConfig ¶
Generates true if KeyRegex matches a log line key and ValueRegex matches that key's value. If ValueRegex is empty then returns true if any key matches If KeyRegex is empty then returns true if any value matches
type LoggingConfig ¶
type LoggingConfig struct { RootSink *SinkConfig `toml:",omitempty"` // Trace debug is very noisy - mostly from Tendermint Trace bool // Send to a channel - will not affect progress if logging graph is intensive but output will lag and some logs // may be missed in shutdown NonBlocking bool }
func DefaultNodeLoggingConfig ¶
func DefaultNodeLoggingConfig() *LoggingConfig
func (*LoggingConfig) JSONString ¶
func (lc *LoggingConfig) JSONString() string
func (*LoggingConfig) Logger ¶ added in v0.31.1
func (lc *LoggingConfig) Logger() (*logging.Logger, error)
Obtain a logger from this LoggingConfig
func (*LoggingConfig) MustLogger ¶ added in v0.31.1
func (lc *LoggingConfig) MustLogger() *logging.Logger
func (*LoggingConfig) None ¶ added in v0.31.1
func (lc *LoggingConfig) None() *LoggingConfig
func (*LoggingConfig) Root ¶
func (lc *LoggingConfig) Root(configure func(sink *SinkConfig) *SinkConfig) *LoggingConfig
func (*LoggingConfig) RootJSONString ¶
func (lc *LoggingConfig) RootJSONString() string
func (*LoggingConfig) RootTOMLString ¶
func (lc *LoggingConfig) RootTOMLString() string
Returns the TOML for a top-level logging config wrapped with logging
func (*LoggingConfig) TOMLString ¶
func (lc *LoggingConfig) TOMLString() string
func (*LoggingConfig) UpdateLogger ¶ added in v0.28.0
Hot swap logging config by replacing output loggers built from this LoggingConfig
func (*LoggingConfig) WithTrace ¶ added in v0.31.1
func (lc *LoggingConfig) WithTrace() *LoggingConfig
type LoggingConfigWrapper ¶
type LoggingConfigWrapper struct {
Logging *LoggingConfig `toml:",omitempty"`
}
For encoding a top-level 'logging' TOML table
type OutputConfig ¶
type OutputConfig struct { OutputType outputType Format string *FileConfig `json:",omitempty" toml:",omitempty"` *SyslogConfig `json:",omitempty" toml:",omitempty"` }
Sink configuration types
func FileOutput ¶
func FileOutput(path string) *OutputConfig
func StderrOutput ¶
func StderrOutput() *OutputConfig
func StdoutOutput ¶
func StdoutOutput() *OutputConfig
func (*OutputConfig) SetFormat ¶
func (outputConfig *OutputConfig) SetFormat(format string) *OutputConfig
type PruneConfig ¶
Sink configuration types
type SinkConfig ¶
type SinkConfig struct { Transform *TransformConfig `json:",omitempty" toml:",omitempty"` Sinks []*SinkConfig `json:",omitempty" toml:",omitempty"` Output *OutputConfig `json:",omitempty" toml:",omitempty"` }
Sink A Sink describes a logger that logs to zero or one output and logs to zero or more child sinks. before transmitting its log it applies zero or one transforms to the stream of log lines. by chaining together many Sinks arbitrary transforms to and multi
func (*SinkConfig) AddSinks ¶
func (sc *SinkConfig) AddSinks(sinks ...*SinkConfig) *SinkConfig
func (*SinkConfig) BuildLogger ¶
func (sc *SinkConfig) BuildLogger() (log.Logger, map[string]*loggers.CaptureLogger, error)
Logger formation
func (*SinkConfig) FilterScope ¶ added in v0.31.1
func (sc *SinkConfig) FilterScope(scope string) *SinkConfig
func (*SinkConfig) Logger ¶ added in v0.31.1
func (sc *SinkConfig) Logger() (*logging.Logger, error)
func (*SinkConfig) LoggingConfig ¶ added in v0.31.1
func (sc *SinkConfig) LoggingConfig() *LoggingConfig
Wrap this sink as RootSink of LoggingCOnfig
func (*SinkConfig) MustLogger ¶ added in v0.31.1
func (sc *SinkConfig) MustLogger() *logging.Logger
func (*SinkConfig) SetOutput ¶
func (sc *SinkConfig) SetOutput(output *OutputConfig) *SinkConfig
func (*SinkConfig) SetTransform ¶
func (sc *SinkConfig) SetTransform(transform *TransformConfig) *SinkConfig
func (*SinkConfig) Terminal ¶ added in v0.31.1
func (sc *SinkConfig) Terminal() *SinkConfig
type SortConfig ¶
type SortConfig struct { // Sort keys-values with keys in this list first Keys []string }
Sink configuration types
type SyslogConfig ¶
Outputs TODO: reintroduce syslog removed when we dropped log15 dependency
type TransformConfig ¶
type TransformConfig struct { TransformType transformType LabelConfig *LabelConfig `json:",omitempty" toml:",omitempty"` PruneConfig *PruneConfig `json:",omitempty" toml:",omitempty"` CaptureConfig *CaptureConfig `json:",omitempty" toml:",omitempty"` FilterConfig *FilterConfig `json:",omitempty" toml:",omitempty"` SortConfig *SortConfig `json:",omitempty" toml:",omitempty"` }
Sink configuration types
func CaptureTransform ¶
func CaptureTransform(name string, bufferCap int, passthrough bool) *TransformConfig
func FilterTransform ¶
func FilterTransform(fmode filterMode, keyValueRegexes ...string) *TransformConfig
func LabelTransform ¶
func LabelTransform(prefix bool, labelKeyvals ...string) *TransformConfig
func OnlyTransform ¶ added in v0.20.1
func OnlyTransform(keys ...string) *TransformConfig
func PruneTransform ¶
func PruneTransform(keys ...string) *TransformConfig
func SortTransform ¶
func SortTransform(keys ...string) *TransformConfig
func VectoriseTransform ¶
func VectoriseTransform() *TransformConfig