logging

package
v0.0.0-...-dd9e68f Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Debugf

func Debugf(format string, args ...interface{})

Debugf convenience function calls the global loggerr.

func Debugln

func Debugln(args ...interface{})

Debugln convenience function calls the global logger.

func Errorf

func Errorf(format string, args ...interface{})

Errorf convenience function calls the global logger.

func Errorln

func Errorln(args ...interface{})

Errorln convenience function calls the global logger.

func Infof

func Infof(format string, args ...interface{})

Infof convenience function calls the global logger.

func Infoln

func Infoln(args ...interface{})

Infoln convenience function calls the global logger.

func SetGlobal

func SetGlobal(i Interface)

SetGlobal sets the global logger.

func Setup

func Setup(logLevel string) error

Setup configures a global logrus logger to output to stderr. It populates the standard logrus logger as well as the global logging instance.

func Warnf

func Warnf(format string, args ...interface{})

Warnf convenience function calls the global logger.

func Warnln

func Warnln(args ...interface{})

Warnln convenience function calls the global logger.

Types

type Fields

type Fields map[string]interface{}

Fields convenience type for adding multiple fields to a log statement.

type Format

type Format struct {
	Logrus logrus.Formatter
	// contains filtered or unexported fields
}

Format is a settable identifier for the output format of logs

func (Format) MarshalYAML

func (f Format) MarshalYAML() (interface{}, error)

MarshalYAML implements yaml.Marshaler.

func (*Format) RegisterFlags

func (f *Format) RegisterFlags(fs *flag.FlagSet)

RegisterFlags adds the log format flag to the provided flagset.

func (*Format) Set

func (f *Format) Set(s string) error

Set updates the value of the output format. Implements flag.Value

func (Format) String

func (f Format) String() string

func (*Format) UnmarshalYAML

func (f *Format) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML implements yaml.Unmarshaler.

type Interface

type Interface interface {
	Debugf(format string, args ...interface{})
	Debugln(args ...interface{})

	Infof(format string, args ...interface{})
	Infoln(args ...interface{})

	Errorf(format string, args ...interface{})
	Errorln(args ...interface{})

	Warnf(format string, args ...interface{})
	Warnln(args ...interface{})

	WithField(key string, value interface{}) Interface
	WithFields(Fields) Interface
}

Interface 'unifies' gokit logging and logrus logging, such that the middleware in this repo can be used in projects which use either loggers.

func Global

func Global() Interface

Global returns the global logger.

func GoKit

func GoKit(logger log.Logger) Interface

GoKit wraps an existing gokit Logger.

func Logrus

func Logrus(l *logrus.Logger) Interface

Logrus wraps an existing Logrus logger.

func NewGoKit

func NewGoKit(l Level) Interface

NewGoKit creates a new Interface backed by a GoKit logger

func NewGoKitFormat

func NewGoKitFormat(l Level, f Format) Interface

NewGoKitFormat creates a new Interface backed by a GoKit logger format can be "json" or defaults to logfmt

func NewLogrus

func NewLogrus(level Level) Interface

NewLogrus makes a new Interface backed by a logrus logger

func NewLogrusFormat

func NewLogrusFormat(level Level, f Format) Interface

NewLogrusFormat makes a new Interface backed by a logrus logger format can be "json" or defaults to logfmt

func Noop

func Noop() Interface

Noop logger.

func WithField

func WithField(key string, value interface{}) Interface

WithField convenience function calls the global logger.

type Level

type Level struct {
	Logrus logrus.Level
	Gokit  level.Option
	// contains filtered or unexported fields
}

Level is a settable identifier for the minimum level a log entry must be have.

func (Level) MarshalYAML

func (l Level) MarshalYAML() (interface{}, error)

MarshalYAML implements yaml.Marshaler.

func (*Level) RegisterFlags

func (l *Level) RegisterFlags(f *flag.FlagSet)

RegisterFlags adds the log level flag to the provided flagset.

func (*Level) Set

func (l *Level) Set(s string) error

Set updates the value of the allowed level. Implments flag.Value.

func (*Level) String

func (l *Level) String() string

func (*Level) UnmarshalYAML

func (l *Level) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML implements yaml.Unmarshaler.

Jump to

Keyboard shortcuts

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