config

package
v1.9.5 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2024 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LogLevelFlag  = "log-level"
	LogFormatFlag = "log-format"
	LevelTrace    = slog.Level(-5)
)

Variables

This section is empty.

Functions

func InitLog

func InitLog(w io.Writer, level slog.Level, format LogFormat)

func InitLogCmd added in v1.9.5

func InitLogCmd(cmd *cobra.Command)

func LogFormatStrings added in v1.9.5

func LogFormatStrings() []string

LogFormatStrings returns a slice of all String values of the enum

func RegisterLogFlags

func RegisterLogFlags(cmd *cobra.Command)

Types

type ContextKey added in v1.5.0

type ContextKey uint8
const (
	URLContextKey ContextKey = iota
)

type LogFormat added in v1.9.5

type LogFormat uint8
const (
	FormatAuto LogFormat = iota
	FormatColor
	FormatPlain
	FormatJSON
)

func LogFormatString added in v1.9.5

func LogFormatString(s string) (LogFormat, error)

LogFormatString retrieves an enum value from the enum constants string name. Throws an error if the param is not part of the enum.

func LogFormatValues added in v1.9.5

func LogFormatValues() []LogFormat

LogFormatValues returns all values of the enum

func (LogFormat) IsALogFormat added in v1.9.5

func (i LogFormat) IsALogFormat() bool

IsALogFormat returns "true" if the value is listed in the enum definition. "false" otherwise

func (LogFormat) MarshalText added in v1.9.5

func (i LogFormat) MarshalText() ([]byte, error)

MarshalText implements the encoding.TextMarshaler interface for LogFormat

func (LogFormat) String added in v1.9.5

func (i LogFormat) String() string

func (*LogFormat) UnmarshalText added in v1.9.5

func (i *LogFormat) UnmarshalText(text []byte) error

UnmarshalText implements the encoding.TextUnmarshaler interface for LogFormat

Jump to

Keyboard shortcuts

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