package
1.2.0
Repository: https://github.com/krostar/logger.git
Documentation: pkg.go.dev

# README

zap

Using zap instance to build a logger.Logger

// there are few ways to build a zap instance

// using the logger configuration
var log, flush, err = zap.New(
    zap.WithConfig(cfg logger.Config),
)

// building it directly
var log, flush, err = zap.New(
    logrus.WithLevel(level logger.Level),
    logrus.WithConsoleFormatter(colored bool),
    logrus.WithJSONFormatter(),
    logrus.WithOutputPaths(output []string),
)

// or by giving an original zap.Config
var log, flush, err = zap.New(
    logrus.WithZapConfig(cfg zap.Config),
)

Once the logger has been built, it can be used like any other logger.Logger.

# Functions

New returns a new zap instance.
WithConfig takes the logger configuration and applies it.
WithConsoleFormatter configures the format of the log output to use "console" (cli) formatter.
WithJSONFormatter configures the format of the log output to use "json" formatter.
WithLevel configures the minimum level of the logger.
WithOutputPaths configures the paths used to write logs to.
WithoutTime configures the logger to log without time.
WithZapConfig applies zap configuration directly into the configuration.

# Structs

Zap implements Logger interface.

# Type aliases

Option defines a function signature to update configuration.