Help us shape the future of Go! Take the 2026 Go Developer Survey

log

package
v0.27.3 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2025 License: MIT Imports: 4 Imported by: 0

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

Constants

This section is empty.

Variables

Out and Err are writers used for normal and error output. Tests may replace them.

Functions

func Debug added in v0.19.1

func Debug(format string, a ...any)

Debug prints a message to the terminal in magenta, for debugging output.

func Error

func Error(format string, a ...any)

Error prints a message to the terminal in red, indicating an error.

func ErrorWriter added in v0.17.1

func ErrorWriter() *logErrorWriter

ErrorWriter returns a new logErrorWriter for use as an io.Writer for error output.

func Fatal

func Fatal(format string, a ...any)

Fatal prints a message to the terminal in red, then exits the program with an error code.

func Info

func Info(format string, a ...any)

Info prints a message to the terminal in cyan, indicating informational output.

func Message

func Message(format string, a ...any)

Message prints a formatted message to the configured Out writer.

func ResetWriters added in v0.25.0

func ResetWriters()

ResetWriters restores writers to their default stdout/stderr.

func SetWriters added in v0.25.0

func SetWriters(out, errOut io.Writer)

SetWriters allows tests to replace the output writers.

func Start

func Start(format string, a ...any)

Start prints a message to the terminal in blue, indicating a starting action.

func Success

func Success(format string, a ...any)

Success prints a message to the terminal in green, indicating a successful action.

func Verbose

func Verbose(v bool, format string, a ...any)

Verbose prints a message to the terminal if v is true, prefixed with '---'.

func Warn

func Warn(format string, a ...any)

Warn prints a message to the terminal in yellow, indicating a warning.

func Writer added in v0.17.1

func Writer() *logWriter

Writer returns a new logWriter for use as an io.Writer for standard output.

Types

This section is empty.

Jump to

Keyboard shortcuts

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