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

# README

logrus

Using logrus instance to build a logger.Logger

// there are few ways to build a logrus instance

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

// building it directly
var log, err = logrus.New(
    logrus.WithLevel(level logger.Level),
    logrus.WithConsoleFormatter(colored bool),
    logrus.WithJSONFormatter(),
    logrus.WithOutput(writer io.Writer),
)

// or by giving an already built logrus instance
var log, err = logrus.New(
    logrus.WithInstance(log *logrus.Logger),
)

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

# Functions

New returns a new logrus instance.
WithConfig takes the logger configuration and applies it.
WithConsoleFormatter configures the format of the log output to use "console" (cli) formatter.
WithInstance set logrus logger instance.
WithJSONFormatter configures the format of the log output to use "json" formatter.
WithLevel configures the minimum level of the logger.
WithOutput configures the writer used to write logs to.
WithoutTime configures the logger to log without time.

# Structs

Logrus implements Logger interface.

# Type aliases

Option defines a function signature to update configuration.