log

package
v0.10.14 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2023 License: MIT Imports: 10 Imported by: 57

Documentation

Index

Constants

View Source
const (
	LevelFlagName  = "log.level"
	FormatFlagName = "log.format"
	ColorFlagName  = "log.color"
)

Variables

This section is empty.

Functions

func CLIFlags

func CLIFlags(envPrefix string) []cli.Flag

func Format

func Format(lf string, color bool) log.Format

Format turns a string and color into a structured Format object

func Level

func Level(s string) log.Lvl

Level parses the level string into an appropriate object

func NewLogger

func NewLogger(cfg CLIConfig) log.Logger

func NewLoggingMiddleware

func NewLoggingMiddleware(lgr log.Logger, next http.Handler) http.Handler

func SetupDefaults

func SetupDefaults()

Types

type CLIConfig

type CLIConfig struct {
	Level  string // Log level: trace, debug, info, warn, error, crit. Capitals are accepted too.
	Color  bool   // Color the log output. Defaults to true if terminal is detected.
	Format string // Format the log output. Supported formats: 'text', 'json'
}

func DefaultCLIConfig

func DefaultCLIConfig() CLIConfig

func ReadCLIConfig

func ReadCLIConfig(ctx *cli.Context) CLIConfig

func ReadLocalCLIConfig added in v0.10.4

func ReadLocalCLIConfig(ctx *cli.Context) CLIConfig

func (CLIConfig) Check

func (cfg CLIConfig) Check() error

Jump to

Keyboard shortcuts

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