File tree Expand file tree Collapse file tree 2 files changed +36
-0
lines changed
Expand file tree Collapse file tree 2 files changed +36
-0
lines changed Original file line number Diff line number Diff line change 1+ package utils
2+
3+ import (
4+ "fmt"
5+ "log"
6+ )
7+
8+ // ANSI color codes
9+ const (
10+ ColorReset = "\033 [0m"
11+ ColorRed = "\033 [31m"
12+ ColorGreen = "\033 [32m"
13+ ColorYellow = "\033 [33m"
14+ ColorCyan = "\033 [36m"
15+ )
16+
17+ // Info prints a formatted informational message in cyan.
18+ func Info (format string , a ... interface {}) {
19+ fmt .Printf (ColorCyan + "[INFO] " + ColorReset + format + "\n " , a ... )
20+ }
21+
22+ // Success prints a formatted success message in green.
23+ func Success (format string , a ... interface {}) {
24+ fmt .Printf (ColorGreen + "[SUCCESS] " + ColorReset + format + "\n " , a ... )
25+ }
26+
27+ // Warn prints a formatted warning message in yellow.
28+ func Warn (format string , a ... interface {}) {
29+ fmt .Printf (ColorYellow + "[WARN] " + ColorReset + format + "\n " , a ... )
30+ }
31+
32+ // Fatal prints a formatted fatal error message in red and exits.
33+ func Fatal (format string , a ... interface {}) {
34+ // We use log.Fatalf to ensure the timestamp and exit behavior are consistent.
35+ log .Fatalf (ColorRed + "[FATAL] " + ColorReset + format , a ... )
36+ }
You can’t perform that action at this time.
0 commit comments