labellogger

package module
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2025 License: MIT Imports: 9 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

View Source
var LogFilePath string

Set to a path to log to a file as well as stdout.

View Source
var PrependDateToLogs = false

Set to true to prepend the date to logs.

Functions

func Debug

func Debug(message string, fmtArgs ...interface{})

Debug logs debug information. Set DEBUG environment variable to enable.

func DebugNoColor

func DebugNoColor(message string, fmtArgs ...interface{})

DebugNoColor logs debug information without applying colorstring syntax to message.

func Error

func Error(message string, fmtArgs ...interface{})

Error logs non-fatal errors.

func ErrorDisplay

func ErrorDisplay(msg string, err error, fmtArgs ...interface{})

func FormatErrors

func FormatErrors(err error) string

FormatErrors returns a string where the error message was split on ': ', and each item is on a new line, indented once more than the previous line.

func IncrementProgressBar

func IncrementProgressBar(onDone ...func())

func Info

func Info(message string, fmtArgs ...interface{})

Info logs infos.

func List

func List(list []string, format string, separator string) string

List formats a list of strings with a format string and separator.

func Log

func Log(verb string, color string, message string, fmtArgs ...interface{})

Log logs a custom message with a verb and color.

func LogNoColor

func LogNoColor(verb string, color string, message string, fmtArgs ...interface{})

LogNoColor logs a message without applying colorstring syntax to message.

func LogNoFormatting

func LogNoFormatting(verb string, color string, message string)

func ProgressBarFinished

func ProgressBarFinished() bool

func ShowingColors

func ShowingColors() bool

ShowingColors returns true if colors (ANSI escape codes) should be printed. Environment variables can control this: NO_COLOR=1 disables colors, and FORCE_COLOR=1 forces colors. Otherwise, heuristics (such as whether the output is an interactive terminal) are used.

func StartProgressBar

func StartProgressBar(total int, verb string, color string)

func StopProgressBar

func StopProgressBar()

func TimeTrack

func TimeTrack(start time.Time, job string, args ...interface{})

TimeTrack logs the time taken for a function to execute, and logs out the time taken. Usage: at the top of your function, defer TimeTrack(time.Now(), "your job name"). To enable, set DEBUG_TIMING environment variable.

func Timing

func Timing(job string, args []interface{}, timeTaken time.Duration)

Timing logs timing debug logs. Mostly used with TimeTrack. To enable, set DEBUG_TIMING environment variable.

func UpdateProgressBar

func UpdateProgressBar(verb string, color string, message string, details ...string)

func Warn

func Warn(message string, fmtArgs ...interface{})

Warn logs warnings.

func WarnDisplay

func WarnDisplay(msg string, err error, fmtArgs ...interface{})

Types

This section is empty.

Jump to

Keyboard shortcuts

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