log

package
v0.0.0-...-e354141 Latest Latest
Warning

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

Go to latest
Published: May 31, 2023 License: EUPL-1.2 Imports: 6 Imported by: 3

Documentation

Overview

Provides a simple log wrapper with up to 5 Loglevels and multiple outputs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Debug

func Debug(v ...interface{})

Prints a debug message to all outputs if Level == DEBUG.

func Debugf

func Debugf(format string, v ...interface{})

Prints a formatted debug message to all outputs if Level == DEBUG.

func Error

func Error(v ...interface{})

Prints an error to all outputs if Level >= ERROR.

func Errorf

func Errorf(format string, v ...interface{})

Prints a formatted error to all outputs if Level >= ERROR.

func Fatal

func Fatal(v ...interface{})

Prints an error to all outputs and exits afterwards with Code 1.

func Fatalf

func Fatalf(format string, v ...interface{})

Prints a formatted error to all outputs and exits afterwards with Code 1.

func Flags

func Flags() int

Returns the output flags.

func Info

func Info(v ...interface{})

Prints an informal message to all outputs if Level >= INFO.

func Infof

func Infof(format string, v ...interface{})

Prints a formatted informal message to all outputs if Level >= INFO.

func Outputs

func Outputs() []io.Writer

Returns every io.Writer with a defined Logger.

func Prefix

func Prefix() string

Returns the output prefix.

func SetFlags

func SetFlags(f int)

Sets the output flags for every output.

func SetLevel

func SetLevel(newLevel Loglevel) error

Sets the Loglevel to one of FATAL, ERROR, WARN, INFO or DEBUG. Returns "Loglevel out of range" if too small or big.

func SetOutputs

func SetOutputs(out []io.Writer) error

Assigns every writer given via out a new Logger. Returns "No outputs given" if out is empty.

func SetPrefix

func SetPrefix(p string)

Sets the output prefix for every output.

func Warn

func Warn(v ...interface{})

Prints a warning to all outputs if Level >= WARN.

func Warnf

func Warnf(format string, v ...interface{})

Prints a formatted warning to all outputs if Level >= WARN.

Types

type Loglevel

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

func Level

func Level() Loglevel

Returns the Loglevel.

func ParseLevel

func ParseLevel(loglvl string) (Loglevel, error)

Transposes string loglvl to corresponding Loglevel. Returns error if string does not match.

Jump to

Keyboard shortcuts

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