logs

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2022 License: MIT Imports: 9 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 interface {
	// Tag returns a new Logger with the extra tag added to it. Tags are logged
	// on every line as a prefix of the message in the form [name:value]
	Tag(name string, value interface{}) Logger

	// Errorf will log a message applying args to the format string in the same
	// way fmt.Sprintf works but applying the [ERROR] prefix to the message
	Errorf(format string, args ...interface{})

	// Warnf will log a message applying args to the format string in the same
	// way fmt.Sprintf works but applying the [WARN] prefix to the message
	Warnf(format string, args ...interface{})

	// Infof will log a message applying args to the format string in the same
	// way fmt.Sprintf works but applying the [INFO] prefix to the message
	Infof(format string, args ...interface{})
}

Logger is the main interface of this package, it's the only interface available to interact with every logger implementation, that's to keep the usage easily integrated in code and tests.

func NewLogrusLogger

func NewLogrusLogger() Logger

NewLogrusLogger creates a new Logger that uses https://github.com/sirupsen/logrus implementation.

type LogrusLogger

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

func (LogrusLogger) Errorf

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

Errorf will log a message applying args to the format string in the same way fmt.Sprintf works but applying the [ERROR] prefix to the message

func (LogrusLogger) Infof

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

Infof will log a message applying args to the format string in the same way fmt.Sprintf works but applying the [INFO] prefix to the message

func (LogrusLogger) Tag

func (l LogrusLogger) Tag(name string, value interface{}) Logger

Tag returns a new Logger with the extra tag added to it. Tags are logged on every line as a prefix of the message in the form [name:value]

func (LogrusLogger) Warnf

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

Warnf will log a message applying args to the format string in the same way fmt.Sprintf works but applying the [WARN] prefix to the message

Jump to

Keyboard shortcuts

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