Skip to content

feat(log): add colored terminal output without external packages#16

Merged
taigrr merged 1 commit into
masterfrom
cd/9-colored-terminal-output
Feb 17, 2026
Merged

feat(log): add colored terminal output without external packages#16
taigrr merged 1 commit into
masterfrom
cd/9-colored-terminal-output

Conversation

@taigrr
Copy link
Copy Markdown
Owner

@taigrr taigrr commented Feb 8, 2026

Summary

Adds ANSI color-coded log levels for terminal output without requiring any external packages.

Fixes #9

Changes

  • New log/color.go with ANSI color constants and helper functions
  • Auto-detection of terminal capability (colors disabled when piping to files)
  • SetColorEnabled(bool) and ColorEnabled() for manual control
  • Updated README with color scheme documentation

Color Scheme

Level Color
TRACE Gray
DEBUG Cyan
INFO Green
NOTICE Blue
WARN Yellow
ERROR Red
PANIC Bold Red
FATAL Bold Red

Testing

  • go test ./... -race passes
  • Tested manually with terminal output

Adds ANSI color-coded log levels for terminal output:
- TRACE: Gray
- DEBUG: Cyan
- INFO: Green
- NOTICE: Blue
- WARN: Yellow
- ERROR/PANIC/FATAL: Red (bold for PANIC/FATAL)

Colors are auto-detected based on terminal capability and can be
controlled via SetColorEnabled()/ColorEnabled().

Fixes #9
@taigrr taigrr merged commit 6a709d3 into master Feb 17, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow for colored output to the terminal without external packages

1 participant