utils

package
v1.2.4 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Verbose bool
)

Functions

func Logger

func Logger(mode DebugMode, msg string)

Logger prints a formatted log message with the appropriate color and label based on the given DebugMode (LOG, WARN, ERROR). The output is only shown if verbose mode is enabled via SetVerbose(true).

Example:

Logger(LOG, "Service started")
Logger(ERROR, "Failed to connect to DB")

Types

type DebugMode

type DebugMode int
const (
	INFO DebugMode = iota
	ERROR
	WARN
)

DebugMode defines different levels of debug output: INFO (INFO), WARN, and ERROR. Each mode is associated with a specific color for terminal output.

The print() method returns a colored string label representing the mode, which is used by the Debug function to format debug messages with consistent styling.

Example output: INFO Application started WARN Cache miss ERROR Failed to connect to database

Jump to

Keyboard shortcuts

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