log

package
v1.31.0 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2023 License: Apache-2.0 Imports: 3 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Debug

func Debug(message string, v ...any)

Debug prints the given message, if the current log level is DEBUG or lower

func DisableDates

func DisableDates()

DisableDates disables the date/time prefix

func Error

func Error(message string, v ...any)

Error prints the given message, if the current log level is ERROR or lower

func Fatal

func Fatal(v ...any)

Fatal prints the given message, and exits the program

func Info

func Info(message string, v ...any)

Info prints the given message, if the current log level is INFO or lower

func IsDebug

func IsDebug() bool

IsDebug returns true if the current log level is DebugLevel or below

func IsTrace

func IsTrace() bool

IsTrace returns true if the current log level is TraceLevel

func Loggable

func Loggable(l Level) bool

Loggable returns true if the given log level is lower or equal to the current log level

func SetLevel

func SetLevel(newLevel Level)

SetLevel sets a new log level

func Trace

func Trace(message string, v ...any)

Trace prints the given message, if the current log level is TRACE

func Warn

func Warn(message string, v ...any)

Warn prints the given message, if the current log level is WARN or lower

Types

type Level

type Level int

Level is a well-known log level, as defined below

const (
	TraceLevel Level = iota
	DebugLevel
	InfoLevel
	WarnLevel
	ErrorLevel
)

Well known log levels

func CurrentLevel

func CurrentLevel() Level

CurrentLevel returns the current log level

func ToLevel

func ToLevel(s string) Level

ToLevel converts a string to a Level. It returns InfoLevel if the string does not match any known log levels.

func (Level) String

func (l Level) String() string

Jump to

Keyboard shortcuts

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