Documentation
¶
Overview ¶
Package log is a wrapper around colorizing the log output. It has functions that allow you to simply write output to the screen for various scenarios.
- Start ==> Blue - Success ==> Green - Info ==> Cyan - Debug ==> Magenta - Warn ==> Yellow - Error ==> Red - Fatal ==> Red (and exits the program)
Index ¶
- Variables
- func Debug(format string, a ...any)
- func Error(format string, a ...any)
- func Fatal(format string, a ...any)
- func Info(format string, a ...any)
- func Message(format string, a ...any)
- func ResetWriters()
- func SetWriters(out, errOut io.Writer)
- func Start(format string, a ...any)
- func Success(format string, a ...any)
- func Verbose(v bool, format string, a ...any)
- func Warn(format string, a ...any)
- type CMDErrorWriter
- type CMDWriter
Constants ¶
This section is empty.
Variables ¶
Out and Err are writers used for normal and error output. Tests may replace them.
Functions ¶
func Fatal ¶
Fatal prints a message to the terminal in red, then exits the program with an error code.
func ResetWriters ¶
func ResetWriters()
ResetWriters restores writers to their default stdout/stderr.
func SetWriters ¶
SetWriters allows tests to replace the output writers.
Types ¶
type CMDErrorWriter ¶
type CMDErrorWriter struct{}
CMDErrorWriter is an io.Writer that prints to the terminal using Error.
func ErrorWriter ¶
func ErrorWriter() *CMDErrorWriter
ErrorWriter returns a new LogErrorWriter for use as an io.Writer for error output.