log

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2026 License: Apache-2.0 Imports: 8 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	AvailableFormats = Formats{FormatJSON, FormatConsole}
)

Functions

func New

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

func NewDefault

func NewDefault() *zap.Logger

NewDefault creates new default logger.

func NewFromOptions

func NewFromOptions(o Options) *zap.Logger

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

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 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

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