log

package
v0.3.13 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package log configures a new logger for an application.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfigureLoggingFlags

func ConfigureLoggingFlags(v *viper.Viper, p *pflag.FlagSet)

func NewErrorStandardLogger

func NewErrorStandardLogger(logger logur.Logger) *log.Logger

NewErrorStandardLogger returns a new standard logger logging on error level.

func NewLogger

func NewLogger(config Config) logur.Logger

NewLogger creates a new logger.

func SetStandardLogger

func SetStandardLogger(logger logur.Logger)

SetStandardLogger sets the global logger's output to a custom logger instance.

func WithFields

func WithFields(logger logur.Logger, fields map[string]interface{}) logur.Logger

WithFields returns a new contextual logger instance with context added to it.

Types

type Config

type Config struct {
	// Format specifies the output log format.
	// Accepted values are: json, logfmt
	Format string `json:"format,omitempty" mapstructure:"format"`

	// Level is the minimum log level that should appear on the output.
	Level string `json:"level,omitempty" mapstructure:"level"`

	// NoColor makes sure that no log output gets colorized.
	NoColor bool `json:"noColor,omitempty" mapstructure:"noColor"`
}

Config holds details necessary for logging.

func (Config) Validate

func (c Config) Validate() (Config, error)

Validate validates the configuration.

Jump to

Keyboard shortcuts

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