Aurora is a lightweight Go library designed for beautiful, colorized, and structured terminal logging. It offers leveled logging with customizable symbols, automatic timestamps, and JSON pretty-printing capabilities, making it ideal for both development and production use.
- 🌈 Colorized Output: Distinct colors for each log level
- ⏱ Timestamps: Automatic inclusion of timestamps
- 📛 Contextual Prefixes: Add module or component-specific prefixes
- 📦 JSON Pretty Printing: Built-in support for structured data
- 🔒 Thread-Safe: Safe concurrent logging
- 🍬 Sugar Functions: Convenient global logging methods
- 🎨 Customizable: Adjust symbols and colors to your liking
Install Aurora using:
go get github.com/olekukonko/aurorapackage main
import "github.com/olekukonko/aurora"
func main() {
// Simple logging with sugar functions
aurora.Info("System initialized")
aurora.Warn("Disk space running low")
aurora.Error("Failed to connect to database")
// Formatted logging
aurora.Debug("User %s logged in with %d attempts", "alice", 3)
}func main() {
// Create a logger with a prefix for context
dbLogger := aurora.With("database")
dbLogger.Info("Connection pool created")
dbLogger.Warn("Slow query detected")
}func main() {
aurora.Br(2)
aurora.Robot(aurora.InfoLevel)
data := map[string]interface{}{
"user": "bob",
"age": 32,
"tags": []string{"admin", "premium"},
}
aurora.Br(2)
aurora.JSON("User Profile", data)
}package main
import (
"bytes"
"github.com/olekukonko/aurora"
)
func main() {
// Custom logger with a buffer
var buf bytes.Buffer
logger := aurora.New(&buf)
logger.Robot(aurora.InfoLevel)
// Full log with timestamp
logger.Logf(aurora.NoticeLevel, "System check completed")
// Inline log (no timestamp)
logger.Inlinef(aurora.DebugLevel, "Processing item %d", 42)
// Plain output (no symbol or timestamp)
logger.Printf(aurora.InfoLevel, "Simple message")
}Aurora supports the following log levels with default symbols and colors:
| Level | Symbol | Color | Usage |
|---|---|---|---|
Alert |
✭ | Blue | Important alerts |
Info |
✔ | Green | Informational messages |
Error |
✘ | Red | Error conditions |
Notice |
⚑ | Yellow | Notable events |
Debug |
⧳ | Cyan | Debug information |
Warn |
⚠ | Magenta | Warning conditions |
Critical |
‼ | White | Critical conditions |
The default logger writes to os.Stdout. Create custom loggers for different outputs:
// Write to a file
file, _ := os.Create("app.log")
fileLogger := aurora.New(file)
// Write to multiple outputs
multiWriter := io.MultiWriter(os.Stdout, file)
multiLogger := aurora.New(multiWriter)Customize symbols and colors for specific log levels:
// Change symbol and color for Debug level
aurora.SetSymbol(aurora.DebugLevel, "[DEBUG]")
aurora.SetColor(aurora.DebugLevel, color.New(color.FgHiWhite))- Contextual Logging: Use
With()to create prefixed loggers for different components. - Level Usage: Reserve
Criticalfor severe issues andDebugfor development verbosity. - Structured Data: Use
JSON()for logging complex data structures. - Production: Combine with file or network writers for persistent logging.
- Testing: Capture output in tests using
bytes.Buffer.
Here’s what Aurora’s output might look like in your terminal:
.=._,=.
' ([o]) `
_)e(_
.'c ."|_|". n`.
'--' /_\ `--'
( )
__) (__
[✔] 2025-03-25 01:23:45 PM System initialized
[⚠] 2025-03-25 01:23:46 PM Disk space running low
[⧳] TestJSON: JSON ↴↴
{
"user": "bob",
"age": 32,
"tags": ["admin", "premium"]
}
(Note: Colors not shown here; see actual terminal for full effect.)
For a real screenshot, consider adding one to your repo:
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch (
git checkout -b feature/xyz) - Commit your changes (
git commit -m "Add xyz") - Push to the branch (
git push origin feature/xyz) - Open a Pull Request
- fatih/color - Terminal color support
- mattes/go-asciibot - ASCII art generation
- nwidger/jsoncolor - JSON colorization
MIT License - see LICENSE for details.

