log

package
v1.0.1-rc.1 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2023 License: MIT Imports: 10 Imported by: 0

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', 'terminal', 'logfmt', 'json', 'json-pretty'
}

func DefaultCLIConfig

func DefaultCLIConfig() CLIConfig

func ReadCLIConfig

func ReadCLIConfig(ctx *cli.Context) CLIConfig

func ReadLocalCLIConfig

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