log

package
v2.26.2 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2024 License: Apache-2.0 Imports: 10 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	AvailableFormats = Formats{FormatJSON, FormatConsole}
)
View Source
var (
	AvailableLogrusFormats = LogrusFormats{LogrusFormatJSON, LogrusFormatConsole}
)

Functions

func New

func New(debug bool, format Format) *zap.Logger

func NewDefault

func NewDefault() *zap.Logger

NewDefault creates new default logger.

func NewFromOptions added in v2.21.0

func NewFromOptions(o Options) *zap.Logger

func NewLogrus

func NewLogrus() *logrus.Logger

func Prefix

func Prefix(e *logrus.Entry, prefix string) *logrus.Entry

Types

type Format

type Format string
const (
	FormatJSON    Format = "JSON"
	FormatConsole Format = "Console"
)

func (*Format) Set

func (f *Format) Set(s string) error

Set implements the cli.Value and flag.Value interfaces.

func (*Format) String

func (f *Format) String() string

String implements the cli.Value and flag.Value interfaces.

func (*Format) Type added in v2.21.0

func (f *Format) Type() string

Type implements the pflag.Value interfaces.

type Formats

type Formats []Format

func (Formats) Contains

func (f Formats) Contains(s Format) bool

func (Formats) String

func (f Formats) String() string

type LogrusFormat added in v2.21.0

type LogrusFormat string
const (
	LogrusFormatJSON    LogrusFormat = "json"
	LogrusFormatConsole LogrusFormat = "console"
)

func (*LogrusFormat) Set added in v2.21.0

func (f *LogrusFormat) Set(s string) error

Set implements the cli.Value and flag.Value interfaces.

func (*LogrusFormat) String added in v2.21.0

func (f *LogrusFormat) String() string

String implements the cli.Value and flag.Value interfaces.

func (*LogrusFormat) Type added in v2.21.0

func (f *LogrusFormat) Type() string

Type implements the pflag.Value interfaces.

type LogrusFormats added in v2.21.0

type LogrusFormats []LogrusFormat

func (LogrusFormats) String added in v2.21.0

func (f LogrusFormats) String() string

type Options

type Options struct {
	// Enable debug logs
	Debug bool
	// Log format (JSON or plain text)
	Format Format
}

Options exports a options struct to be used by cmd's.

func NewDefaultOptions

func NewDefaultOptions() Options

func (*Options) AddFlags

func (o *Options) AddFlags(fs *flag.FlagSet)

func (*Options) AddPFlags added in v2.21.0

func (o *Options) AddPFlags(fs *pflag.FlagSet)

func (*Options) Validate

func (o *Options) Validate() error

Jump to

Keyboard shortcuts

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