logger

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: May 20, 2024 License: Apache-2.0 Imports: 4 Imported by: 5

Documentation

Index

Constants

View Source
const (
	// LogLevelDebug denotes debug messages
	LogLevelDebug = "debug"
	// LogLevelInfo denotes info messages
	LogLevelInfo = "info"
	// LogLevelWarn denotes warn messages
	LogLevelWarn = "warn"
	// LogLevelError denotes error messages
	LogLevelError = "error"
)
View Source
const (
	ErrorKey = "error"
)

Variables

This section is empty.

Functions

func Level

func Level(l LogLevel) int

Level assigns an integer to the LogLevel string

Types

type LogContext

type LogContext map[string]interface{}

LogContext defines the context for the logs.

type LogLevel

type LogLevel string

LogLevel defines the level of log messages

type Logger

type Logger interface {
	// With adds a logContext to the logger.
	With(LogContext) Logger
	// WithError adds an Error to the logger.
	WithError(error) Logger
	// Context returns the current context
	Context() LogContext
	// Timed add a timed log context.
	Timed() Logger
	// Debugf logs a formatted string as a debug message.
	Debugf(format string, args ...interface{})
	// Errorf logs a formatted string as an error message.
	Errorf(format string, args ...interface{})
	// Infof logs a formatted string as an info message.
	Infof(format string, args ...interface{})
	// Warnf logs a formatted string as an warning message.
	Warnf(format string, args ...interface{})
}

Logger defines an object able to log messages.

func New

func New(api common.LogAPI) Logger

New creates a new logger.

- api: LogAPI implementation

func NewNilLogger

func NewNilLogger() Logger

NewNilLogger returns a logger that performs no action.

func NewTestLogger

func NewTestLogger() Logger

NewTestLogger creates a logger for testing purposes.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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