logging

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2021 License: MIT Imports: 2 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 {
	Init()
	Trace(string, ...interface{})
	Debug(string, ...interface{})
	Info(string, ...interface{})
	Warn(string, ...interface{})
	Error(string, ...interface{})
	Fatal(string, ...interface{})
}

The Logger interface is an abstraction for logging from quacktors. By default, a logrus implementation is included but another logger like zap or zerolog can easily be implemented.

type LogrusLogger

type LogrusLogger struct {
	Log *logrus.Logger
}

The LogrusLogger is the default logger for quacktors. As the name implies, it uses logrus under the hood.

func (*LogrusLogger) Debug

func (l *LogrusLogger) Debug(message string, values ...interface{})

Debug adds a logrus log entry on the corresponding log level

func (*LogrusLogger) Error

func (l *LogrusLogger) Error(message string, values ...interface{})

Error adds a logrus log entry on the corresponding log level

func (*LogrusLogger) Fatal

func (l *LogrusLogger) Fatal(message string, values ...interface{})

Fatal adds a logrus log entry on the corresponding log level and quits the application with exit-code 1

func (*LogrusLogger) Info

func (l *LogrusLogger) Info(message string, values ...interface{})

Info adds a logrus log entry on the corresponding log level

func (*LogrusLogger) Init

func (l *LogrusLogger) Init()

Init initializes the LogrusLogger with the default config (ForceColors=true, LogLevel=Trace)

func (*LogrusLogger) Trace

func (l *LogrusLogger) Trace(message string, values ...interface{})

Trace adds a logrus log entry on the corresponding log level

func (*LogrusLogger) Warn

func (l *LogrusLogger) Warn(message string, values ...interface{})

Warn adds a logrus log entry on the corresponding log level

type NoopLogger

type NoopLogger struct {
}

The NoopLogger is an empty implementation of Logger. This can be used to disable the logging capabilities of quacktors.

func (*NoopLogger) Debug

func (l *NoopLogger) Debug(message string, values ...interface{})

Debug noop implementation

func (*NoopLogger) Error

func (l *NoopLogger) Error(message string, values ...interface{})

Error noop implementation

func (*NoopLogger) Fatal

func (l *NoopLogger) Fatal(message string, values ...interface{})

Fatal does not print (as this is a noop implementation), but does exit the application with exit code 1, as this is a "Fatal" method.

func (*NoopLogger) Info

func (l *NoopLogger) Info(message string, values ...interface{})

Info noop implementation

func (*NoopLogger) Init

func (l *NoopLogger) Init()

Init noop implementation

func (*NoopLogger) Trace

func (l *NoopLogger) Trace(message string, values ...interface{})

Trace noop implementation

func (*NoopLogger) Warn

func (l *NoopLogger) Warn(message string, values ...interface{})

Warn noop implementation

Jump to

Keyboard shortcuts

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