logger

package
v0.34.0 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2022 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Logger

type Logger struct {
	*zap.Logger
	// contains filtered or unexported fields
}

Logger represents a component for writing messages to log.

func NewLogger

func NewLogger(prm *Prm) (*Logger, error)

NewLogger constructs a new zap logger instance. Constructing with nil parameters is safe: default values will be used then. Passing non-nil parameters after a successful creation (non-error) allows runtime reconfiguration.

Logger is built from production logging configuration with:

  • parameterized level;
  • console encoding;
  • ISO8601 time encoding.

Logger records a stack trace for all messages at or above fatal level.

type Prm added in v0.20.0

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

Prm groups Logger's parameters. Successful passing non-nil parameters to the NewLogger (if returned error is nil) connects the parameters with the returned Logger. Parameters that have been connected to the Logger support its configuration changing.

Passing Prm after a successful connection via the NewLogger, connects the Prm to a new instance of the Logger.

See also Reload, SetLevelString.

func (Prm) Reload added in v0.33.0

func (p Prm) Reload() error

Reload reloads configuration of a connected instance of the Logger. Returns ErrLoggerNotConnected if no connection has been performed. Returns any reconfiguration error from the Logger directly.

func (*Prm) SetLevelString added in v0.20.0

func (p *Prm) SetLevelString(s string) error

SetLevelString sets the minimum logging level. Default is "info".

Returns an error if s is not a string representation of a supporting logging level.

Supports runtime rereading.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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