https://github.com/billowdev/clog
A powerful, colorful, and feature-rich logging package that provides enhanced logging
https://github.com/billowdev/clog
Last synced: 8 months ago
JSON representation
A powerful, colorful, and feature-rich logging package that provides enhanced logging
- Host: GitHub
- URL: https://github.com/billowdev/clog
- Owner: billowdev
- License: mit
- Created: 2024-12-11T04:55:03.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-12-11T06:10:58.000Z (about 1 year ago)
- Last Synced: 2025-03-31T04:38:40.221Z (9 months ago)
- Language: Go
- Homepage:
- Size: 10.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# đ clog - Colored Logger for Golang
A powerful, colorful, and feature-rich logging package that provides enhanced logging capabilities with emoji indicators, color-coded output, and comprehensive debugging features.
### ⨠Features
- Color-coded output with emoji indicators
- UTC timestamps with millisecond precision
- File and line number tracking
- Goroutine ID tracking
- Performance metrics logging
- Multiple log levels with filtering
- Panic handling with stack traces
- Configurable output formatting
### đĨ Installation
```bash
go get github.com/billowdev/clog
```
### đ° Quick Start
```go
package main
import "github.com/billowdev/clog"
func main() {
// Configure logging
clog.SetLogLevel(clog.DebugLevel)
clog.Info("Starting application...")
clog.Success("Connected to database")
clog.Error("Failed to connect: %v", err)
}
```
đ¯ Log Levels
- PanicLevel - System is unusable (đĨ)
- ErrorLevel - Error events (â)
- WarningLevel - Warning messages (â ī¸)
- InfoLevel - General information (âšī¸)
- DebugLevel - Debug information (đ)
- TraceLevel - Detailed debugging (đ)
### âī¸ Configuration
```go
// Set minimum log level
clog.SetLogLevel(clog.DebugLevel)
// Enable/disable file and line info
clog.SetShowFileLine(true)
// Enable/disable goroutine ID
clog.SetShowGoroutineID(true)
```
### đ Example Output
- đ INIT [2024-12-11 15:04:05.123 UTC] [main.go:25] (goroutine 1) Starting service
- âī¸ CONFIG [2024-12-11 15:04:05.124 UTC] [main.go:26] Loading configuration
- âšī¸ INFO [2024-12-11 15:04:05.125 UTC] [main.go:27] Processing request
- â
SUCCESS [2024-12-11 15:04:05.126 UTC] [main.go:28] Request completed
- â ERROR [2024-12-11 15:04:05.127 UTC] [main.go:29] Connection failed
### đ¨ Log Types
- âšī¸ INFO - General information
- â
SUCCESS - Successful operations
- đ INIT - Initialization events
- âī¸ CONFIG - Configuration events
- â ī¸ WARNING - Warning messages
- â ERROR - Error messages
- đ DEBUG - Debug information
- đ TRACE - Trace-level debugging
- đĨ PANIC - Critical errors
- đ METRIC - Performance metrics
### đ Usage Examples
Basic Logging:
```go
clog.Info("Processing request from %s", clientIP)
clog.Success("Request completed successfully")
clog.Warning("High memory usage: %d%%", memoryUsage)
clog.Error("Failed to connect: %v", err)
```
Metrics & Debug:
```go
// Performance metrics
clog.Metric("response_time_ms", 150, "endpoint=/api/users", "method=GET")
// Debug info
clog.Debug("Request payload: %+v", payload)
clog.Trace("SQL query: %s", query)
```
### đ License
MIT License
đ¤ Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
### đĄ Support
For support, please open an issue in the GitHub repository.