burrow: github.com/hyperledger/burrow/logging/logconfig Index | Files | Directories

package logconfig

import "github.com/hyperledger/burrow/logging/logconfig"

Index

Package Files

config.go filter.go format.go sinks.go sort.go

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"
)

func BuildFilterPredicate Uses

func BuildFilterPredicate(filterConfig *FilterConfig) (func([]interface{}) bool, error)

func BuildKeyValuesPredicate Uses

func BuildKeyValuesPredicate(kvpConfigs []*KeyValuePredicateConfig, matchAll bool) (func([]interface{}) bool, error)

func BuildLoggerFromSinkConfig Uses

func BuildLoggerFromSinkConfig(sinkConfig *SinkConfig, captures map[string]*loggers.CaptureLogger) (log.Logger,
    map[string]*loggers.CaptureLogger, error)

func BuildOutputLogger Uses

func BuildOutputLogger(outputConfig *OutputConfig) (log.Logger, error)

func BuildTransformLogger Uses

func BuildTransformLogger(transformConfig *TransformConfig, captures map[string]*loggers.CaptureLogger,
    outputLogger log.Logger) (log.Logger, map[string]*loggers.CaptureLogger, error)

func BuildTransformLoggerPassthrough Uses

func BuildTransformLoggerPassthrough(transformConfig *TransformConfig, captures map[string]*loggers.CaptureLogger,
    outputLogger log.Logger) (log.Logger, map[string]*loggers.CaptureLogger, error)

func JSONString Uses

func JSONString(v interface{}) string

func TOMLString Uses

func TOMLString(v interface{}) string

type CaptureConfig Uses

type CaptureConfig struct {
    Name        string
    BufferCap   int
    Passthrough bool
}

Sink configuration types

type FileConfig Uses

type FileConfig struct {
    Path string
}

Sink configuration types

type FilterConfig Uses

type FilterConfig struct {
    FilterMode filterMode
    // Predicates to match a log line against using FilterMode
    Predicates []*KeyValuePredicateConfig
}

Filter types

func (*FilterConfig) AddPredicate Uses

func (filterConfig *FilterConfig) AddPredicate(keyRegex, valueRegex string) *FilterConfig

func (*FilterConfig) SetFilterMode Uses

func (filterConfig *FilterConfig) SetFilterMode(filterMode filterMode) *FilterConfig

type KeyValuePredicateConfig Uses

type KeyValuePredicateConfig struct {
    KeyRegex   string
    ValueRegex string
}

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 LabelConfig Uses

type LabelConfig struct {
    Labels map[string]string
    Prefix bool
}

Transforms

type LoggingConfig Uses

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 Uses

func DefaultNodeLoggingConfig() *LoggingConfig

func New Uses

func New() *LoggingConfig

Provide a defeault logging config

func (*LoggingConfig) JSONString Uses

func (lc *LoggingConfig) JSONString() string

func (*LoggingConfig) NewLogger Uses

func (lc *LoggingConfig) NewLogger() (*logging.Logger, error)

Obtain a logger from this LoggingConfig

func (*LoggingConfig) Root Uses

func (lc *LoggingConfig) Root(configure func(sink *SinkConfig) *SinkConfig) *LoggingConfig

func (*LoggingConfig) RootJSONString Uses

func (lc *LoggingConfig) RootJSONString() string

func (*LoggingConfig) RootTOMLString Uses

func (lc *LoggingConfig) RootTOMLString() string

Returns the TOML for a top-level logging config wrapped with [logging]

func (*LoggingConfig) TOMLString Uses

func (lc *LoggingConfig) TOMLString() string

func (*LoggingConfig) UpdateLogger Uses

func (lc *LoggingConfig) UpdateLogger(logger *logging.Logger) (channels.Channel, error)

Hot swap logging config by replacing output loggers built from this LoggingConfig

type LoggingConfigWrapper Uses

type LoggingConfigWrapper struct {
    Logging *LoggingConfig `toml:",omitempty"`
}

For encoding a top-level '[logging]' TOML table

type OutputConfig Uses

type OutputConfig struct {
    OutputType    outputType
    Format        string
    *FileConfig   `json:",omitempty" toml:",omitempty"`
    *SyslogConfig `json:",omitempty" toml:",omitempty"`
}

Sink configuration types

func FileOutput Uses

func FileOutput(path string) *OutputConfig

func StderrOutput Uses

func StderrOutput() *OutputConfig

func StdoutOutput Uses

func StdoutOutput() *OutputConfig

func (*OutputConfig) SetFormat Uses

func (outputConfig *OutputConfig) SetFormat(format string) *OutputConfig

type PruneConfig Uses

type PruneConfig struct {
    Keys        []string
    IncludeKeys bool
}

Sink configuration types

type SinkConfig Uses

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 Sink Uses

func Sink() *SinkConfig

Builders

func (*SinkConfig) AddSinks Uses

func (sinkConfig *SinkConfig) AddSinks(sinks ...*SinkConfig) *SinkConfig

func (*SinkConfig) BuildLogger Uses

func (sinkConfig *SinkConfig) BuildLogger() (log.Logger, map[string]*loggers.CaptureLogger, error)

Logger formation

func (*SinkConfig) SetOutput Uses

func (sinkConfig *SinkConfig) SetOutput(output *OutputConfig) *SinkConfig

func (*SinkConfig) SetTransform Uses

func (sinkConfig *SinkConfig) SetTransform(transform *TransformConfig) *SinkConfig

type SortConfig Uses

type SortConfig struct {
    // Sort keys-values with keys in this list first
    Keys []string
}

Sink configuration types

type SyslogConfig Uses

type SyslogConfig struct {
    Url string
    Tag string
}

Outputs TODO: reintroduce syslog removed when we dropped log15 dependency

type TransformConfig Uses

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 Uses

func CaptureTransform(name string, bufferCap int, passthrough bool) *TransformConfig

func FilterTransform Uses

func FilterTransform(fmode filterMode, keyValueRegexes ...string) *TransformConfig

func LabelTransform Uses

func LabelTransform(prefix bool, labelKeyvals ...string) *TransformConfig

func OnlyTransform Uses

func OnlyTransform(keys ...string) *TransformConfig

func PruneTransform Uses

func PruneTransform(keys ...string) *TransformConfig

func SortTransform Uses

func SortTransform(keys ...string) *TransformConfig

func VectoriseTransform Uses

func VectoriseTransform() *TransformConfig

Directories

PathSynopsis
presets

Package logconfig imports 11 packages (graph) and is imported by 20 packages. Updated 2020-05-03. Refresh now. Tools for package owners.