loggingfx

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2025 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Level must be supported by the selected log adapter, most support this:
	// "debug", "info", "warn", "error"
	// some include more level:
	// "trace", "fatal"
	Level string `mapstructure:"level" default:"info"`

	// Output is the logging sink to use, currently supported:
	// "stdout", "stderr", "<filename>"
	Output string `mapstructure:"output" default:"stdout"`

	// Format is the logging encoding, currently supported:
	// "text", "json"
	Format string `mapstructure:"format" default:"text"`

	// FormatTime is the time encoding, all golang time formats are supported.
	// Defaults to [time.RFC3339]
	TimeFormat string `mapstructure:"timeFormat" default:""`
}

Config defines a configuration for use with loggers

func DefaultConfig

func DefaultConfig() (Config, error)

DefaultConfig returns the default logging configuration to be used until a config file has been parsed to configure the real logger. It reads environment variables LOG_* to adjust logging as early as possible before even config parsing takes place.

type ConfigWithLogging

type ConfigWithLogging interface {
	LoggingConfig() Config
}

ConfigWithLogging denotes types which implement LoggingConfig(). Used to decorate loggers if a config provides logging details.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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