logger

package
v0.0.0-...-ffea4ed Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidLogLevel = errors.New("invalid loglevel")

Functions

This section is empty.

Types

type LogLevel

type LogLevel int
const (
	FATAL LogLevel = iota
	ERROR
	WARN
	INFO
	DEBUG
)

func StringToLogLevel

func StringToLogLevel(s string) (LogLevel, error)

func (LogLevel) String

func (l LogLevel) String() string

String implements the stringer interface

type Logger

type Logger interface {
	Log(LogLevel, ...interface{})
}

Logger interface specification

type StdLog

type StdLog struct {
	Level       LogLevel
	ExitOnFatal bool
	// contains filtered or unexported fields
}

StdLog turns a standard logger into a Logger interface implementation

func NewStdLog

func NewStdLog(lvl LogLevel, logger *log.Logger) *StdLog

func (StdLog) Log

func (l StdLog) Log(lvl LogLevel, args ...interface{})

Log will output a log line with the caller function, line and the arguments Arguments are primarily considered in key/value pairs, i.e. Log("key1", "value1", "key2", "value2") If there is no 2nd value argument given, the single argument will be used, i.e. Log("Single argument") or Log("key1", "value1", "single argument")

Jump to

Keyboard shortcuts

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