log

package
v1.15.2 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2024 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const LevelTrace slog.Level = -5

Variables

This section is empty.

Functions

func AddMask added in v1.15.0

func AddMask(mask string)

func FormatStrings added in v1.15.0

func FormatStrings() []string

FormatStrings returns a slice of all String values of the enum

func Init added in v1.15.0

func Init(w io.Writer, level slog.Level, format Format)

func LevelStrings added in v1.15.0

func LevelStrings() []string

func MaskAttr added in v1.15.0

func MaskAttr(_ []string, attr slog.Attr) slog.Attr

Types

type Format added in v1.15.0

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

func FormatString added in v1.15.0

func FormatString(s string) (Format, error)

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

func FormatValues added in v1.15.0

func FormatValues() []Format

FormatValues returns all values of the enum

func InitFromCmd added in v1.15.0

func InitFromCmd(cmd *cobra.Command) (slog.Level, Format)

func (Format) IsAFormat added in v1.15.0

func (i Format) IsAFormat() bool

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

func (Format) MarshalText added in v1.15.0

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

MarshalText implements the encoding.TextMarshaler interface for Format

func (Format) String added in v1.15.0

func (i Format) String() string

func (*Format) UnmarshalText added in v1.15.0

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

UnmarshalText implements the encoding.TextUnmarshaler interface for Format

type Writer

type Writer struct {
	// contains filtered or unexported fields
}

func NewWriter

func NewWriter(logger *slog.Logger, level slog.Level) Writer

func (Writer) Write

func (l Writer) Write(p []byte) (int, error)

Jump to

Keyboard shortcuts

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