log

package
v0.0.0-...-92e4a68 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2026 License: EUPL-1.2 Imports: 5 Imported by: 0

Documentation

Overview

Package log provides a simple logging interface with ANSI color support for terminal output. It allows for colored output to stdout and stderr, making it easier to distinguish between different types of messages. The package includes functions for printing plain, success, and error messages with optional formatting.

Index

Examples

Constants

View Source
const (
	AnsiNone            ansiCode = ""
	AnsiReset           ansiCode = "0"
	AnsiRed             ansiCode = "31"
	AnsiGreen           ansiCode = "32"
	ArgsFormatSpecifier string   = "%[]"
)

Variables

This section is empty.

Functions

func Error

func Error(args ...any)
Example
oldStderr := os.Stderr
os.Stderr = os.Stdout
defer func() { os.Stderr = oldStderr }()

Error("Goodbye", " ", "World!")
Output:
✗ Goodbye World!

func Errorf

func Errorf(format string, args ...any)
Example
oldStderr := os.Stderr
os.Stderr = os.Stdout
defer func() { os.Stderr = oldStderr }()

Errorf("Goodbye %s!", "World")
Output:
✗ Goodbye World!

func Info

func Info(args ...any)
Example
Info("We're on Earth", ".")
Output:
ℹ We're on Earth.

func Infof

func Infof(format string, args ...any)
Example
Infof("We're on %s.", "Earth")
Output:
ℹ We're on Earth.

func Success

func Success(args ...any)
Example
Success("Hello", " ", "World!")
Output:
✓ Hello World!

func Successf

func Successf(format string, args ...any)
Example
Successf("Hello %s!", "World")
Output:
✓ Hello World!

Types

This section is empty.

Jump to

Keyboard shortcuts

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