log

package
v0.0.0-...-02e3eee Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2024 License: GPL-3.0, LGPL-3.0 Imports: 4 Imported by: 0

Documentation

Overview

log provides logging functions with level-prefixes and customized options. Logging flags are configured primarily for short-term usage, with date-flag disabled, and the time-flag and microseconds-flag enabled.

TODO consider providing option for adding terminal coloring. It would be nice to de-emphasize timestamp, emphasize log-level, and normalize at logged content. (os.Stdout.Fd() == 1, etc. Makes for easy testing if output is Std{Err,Out})

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Debug

func Debug(line string)

Debug writes output to os.Stderr with prefix 'debug'.

func DebugReport

func DebugReport(assert bool, format string, args ...any)

DebugReport logs a debug-level message in case the assertion does not hold.

func Debugf

func Debugf(format string, args ...any)

Debugf writes a line to os.Stderr with prefix 'debug', using fmt formatting options.

func Debugln

func Debugln(args ...any)

Debugln writes a line to os.Stderr with prefix `debug`, then ends with newline.

func DebuglnMap

func DebuglnMap[K comparable, V any](prefix string, data map[K]V)

DebuglnMap prints each entry in `data` (every key in the map) on a new line. Every debug-line is prefixed with `prefix`.

func DebuglnSlice

func DebuglnSlice[T any](prefix string, data []T)

DebuglnSlice prints each entry in `data` on a new line. Every debug-line is prefixed with `prefix`.

func DebuglnSliceAsString

func DebuglnSliceAsString(prefix string, data [][]byte)

DebuglnSliceAsString prints each entry in `data` on a new line. Every debug-line is prefixed with `prefix`. Each line of data (bytes), are printed as ANSI characters, thus converted to a string.

func Error

func Error(line string)

Error writes a line to os.Stderr with prefix 'ERROR'.

func Errorf

func Errorf(format string, args ...any)

Errorf writes a line to os.Stderr with prefix 'ERROR', using fmt formatting options.

func Errorln

func Errorln(args ...any)

Errorln writes a line to os.Stderr with prefix 'ERROR', closing with newline.

func Flags

func Flags() int

func Info

func Info(line string)

Info writes a line to os.Stderr with prefix 'info'.

func Infof

func Infof(format string, args ...any)

Info writes a line to os.Stderr with prefix 'info'.

func Infoln

func Infoln(args ...any)

Infoln writes a line to os.Stderr with prefix 'info', closing with newline.

func SetFlags

func SetFlags(flags int)

func SetOutput

func SetOutput(output io.Writer)

func SetTraceFlags

func SetTraceFlags(flags int)

func SetTraceOutput

func SetTraceOutput(output io.Writer)

func TraceFlags

func TraceFlags() int

func TraceReport

func TraceReport(assert bool, format string, args ...any)

func Tracef

func Tracef(format string, args ...any)

func TracefDepth

func TracefDepth(depth uint, format string, args ...any)

func Traceln

func Traceln(args ...any)

func TracelnDepth

func TracelnDepth(depth uint, args ...any)

func TracelnMap

func TracelnMap[K comparable, V any](prefix string, data map[K]V)

func TracelnSliceAsString

func TracelnSliceAsString(prefix string, data [][]byte)

func Tracing

func Tracing() bool

func Warn

func Warn(line string)

Warn writes a line to os.Stderr with prefix 'warn'.

func Warnf

func Warnf(format string, args ...any)

Warn writes a line to os.Stderr with prefix 'warn'.

func Warnln

func Warnln(args ...any)

Warnln writes a line to os.Stderr with prefix 'warn', closing with newline.

Types

This section is empty.

Jump to

Keyboard shortcuts

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