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

log

package
v1.49.0 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2026 License: MIT Imports: 6 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/Primary - Success ==> Green/Secondary - Info ==> Cyan/Primary - Debug ==> Magenta - Warn ==> Yellow - Error ==> Red/Destructive

Index

Constants

This section is empty.

Variables

View Source
var (
	Out io.Writer = os.Stdout
	Err io.Writer = os.Stderr
)

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

Functions

func Debug

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 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

func ResetWriters()

ResetWriters restores writers to their default stdout/stderr.

func SetWriters

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.

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.

func (*CMDErrorWriter) Write

func (w *CMDErrorWriter) Write(p []byte) (n int, err error)

Write implements io.Writer for LogErrorWriter, printing output as an error message.

type CMDWriter

type CMDWriter struct{}

CMDWriter is an io.Writer that writes to the terminal using Info.

func Writer

func Writer() *CMDWriter

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

func (*CMDWriter) Write

func (w *CMDWriter) Write(p []byte) (n int, err error)

Write implements io.Writer for LogWriter, printing output as an info message.

Jump to

Keyboard shortcuts

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