๐ฏ CAND - Colorful And Nice Debugging
Beautiful embedded-first Rust logging library for ESP32 to servers with colorful output and zero-panic design.
โจ Why Choose CAND?
| Feature | Benefit | Use Case |
|---|---|---|
| ๐จ Smart Colors | Spot issues instantly | logger.log_err("โ Clear visibility") |
| โก no_std Ready | Runs everywhere | ESP32, STM32, WASM, bare metal |
| ๐ก๏ธ Never Panic | Production safe | try_run() and try_get() handles all errors gracefully |
| ๐ Pluggable | Your infrastructure | Files, UART, RTT, databases, networks |
| ๐ฆ Tiny Binary | <1KB overhead | Perfect for memory-constrained devices |
| ๐ฏ 2-Line Setup | Start in seconds | Works out of the box |
๐ Quick Start
Desktop/Server
[]
= "0.2.3"
use Logger;
use Instant;
Embedded/ESP32 with no_std
[]
= { = "0.2.3", =false, =["colors"] }
Embedded/ESP32 with alloc but no_std
[]
= { = "0.2.3", =false, =["colors", "alloc"] }
use ;
;
๐จ Beautiful Output
CAND automatically color-codes your logs for instant visual feedback:
- ๐ข
log_ok()- Success operations (green) - ๐ต
log_info()- Informational messages (blue) - ๐ก
log_warn()- Warnings that need attention (yellow) - ๐ด
log_err()- Critical errors (red)

๐ก๏ธ Error Handling That Never Panics
use Logger;
๐ก๏ธ Panic Handling with black_box_cand
CAND provides a macro to set up a panic handler that logs panics using the logger, ensuring even panics are captured gracefully.
use ;
For no_std environments, the macro sets a panic_handler that logs to the provided logger.
๐ Custom Storage Providers
Embedded UART with ufmt
[]
= { = "0.2.3", =false, =["colors", "ufmt"] }
;
Standard Output with fmt
๐๏ธ Feature Flags
| Feature | Description | Default |
|---|---|---|
std |
Standard library support, enables Instant time provider |
โ |
colors |
ANSI color output for beautiful terminal logs | โ |
ufmt |
Embedded-friendly formatting with zero allocations, supports both no_std and std | No |
alloc |
Enables Box for dynamic error handling | โ |
๐ Performance
- โก Zero allocations with
ufmtfeature - ๐ 1_000_000 logs in 4.2s (for alloc takes 5.1s) on example benchmark with decent release
๐๏ธ API Reference
Core Types
// Standard fmt-based logger
;
// Clonable version for multi-threaded use
;
// ufmt-based logger (requires "ufmt" feature)
;
// Clonable ufmt-based logger
;
Traits
TimeProvider: For timestamping logs (e.g.,Instantor custom)StorageProvider: For fmt-based output destinationsUStorageProvider: For ufmt-based output destinations
๐งช Examples
Check out the examples directory:
basic_error_handling- Error recovery patternssample- Feature showcase and demobenchmark- Benchmark of 1_000_000 logs printerrorcand- Advanced error handling with try_get and try_runpaniccand- Panic handling demonstration with black_box_candcustom_panic- Same Panic handling but customcustom_panic_global- And this one is globally share
Run examples:
๐ License
This project is licensed under the MIT License - see the LICENSE file for details.