micrologging

package module
v0.0.0-...-0c6e447 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2020 License: MIT Imports: 7 Imported by: 0

README

micrologging

Simplistic logging for golang

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddRootOutput

func AddRootOutput(output io.Writer)

SetRootOutput assigns an io.Writer to root logger

func Debug

func Debug(format string, messages ...interface{})

func Error

func Error(format string, messages ...interface{})

func Fatal

func Fatal(format string, messages ...interface{})

func Info

func Info(format string, messages ...interface{})

func SetRootLevel

func SetRootLevel(level Level)

SetRootLevel sets the loglvevel of the root logger

func Trace

func Trace(format string, messages ...interface{})

func Warn

func Warn(format string, messages ...interface{})

Types

type Level

type Level uint8

Level represents the loglevel, from TRACE (0) to FATAL (6)

const (
	TRACE Level = iota
	DEBUG
	INFO
	WARN
	ERROR
	FATAL
)

func LevelFromString

func LevelFromString(str string) (Level, error)

LevelFromString reconstructs the loglevel from a given string. It is case insensitive and recognizes some commong loglevel name synonyms, such as WARN=WARNING, ERR=ERROR

func (Level) String

func (l Level) String() string

type Logger

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

func GetLogger

func GetLogger(name string) *Logger

GetLogger constructs the child logger of the root with specified name

func (*Logger) Debug

func (l *Logger) Debug(format string, messages ...interface{})

func (*Logger) Error

func (l *Logger) Error(format string, messages ...interface{})

func (*Logger) Fatal

func (l *Logger) Fatal(format string, messages ...interface{})

func (*Logger) Info

func (l *Logger) Info(format string, messages ...interface{})

func (*Logger) Printf

func (l *Logger) Printf(level Level, format string, messages ...interface{})

Printf logs the line with given loglevel, formatted according to format, using the root logger

func (*Logger) Trace

func (l *Logger) Trace(format string, messages ...interface{})

func (*Logger) Warn

func (l *Logger) Warn(format string, messages ...interface{})

Jump to

Keyboard shortcuts

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