summaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
authorMitja Felicijan <mitja.felicijan@gmail.com>2026-01-21 19:24:49 +0100
committerMitja Felicijan <mitja.felicijan@gmail.com>2026-01-21 19:24:49 +0100
commit61ec593c95f3210bdfcd22539d43ef507210981f (patch)
tree6a74c720944330505977ebfdcf813b05a33ccade /README.md
parent7b75ac0962be8ed19a1eca638f600ebee337a18a (diff)
downloadnonstd-61ec593c95f3210bdfcd22539d43ef507210981f.tar.gz
Add logging
Diffstat (limited to 'README.md')
-rw-r--r--README.md19
1 files changed, 19 insertions, 0 deletions
diff --git a/README.md b/README.md
index b509377..7004467 100644
--- a/README.md
+++ b/README.md
@@ -18,6 +18,7 @@ ergonomic and productive. It aims to be C99 compliant.
- **Slices (`slice`)**: Generic non-owning views into arrays.
- **Memory Arena**: Simple block-based arena allocator for bulk memory management.
- **File I/O**: Helper functions to read and write entire files with a single call.
+- **Logging**: Simple, leveled logging with ANSI colors and timestamps.
## Installation
@@ -165,6 +166,24 @@ sb_free(&file_sb);
```
+### 6. Logging
+
+Simple logging with levels (`ERROR`, `WARN`, `INFO`, `DEBUG`), timestamps, and colors.
+
+```c
+// Set log level (default is INFO)
+set_log_level(LOG_DEBUG);
+
+// Use macros for logging
+LOG_INFO_MSG("Starting application...");
+LOG_DEBUG_MSG("Variable x = %d", 42);
+LOG_WARN_MSG("Low memory warning");
+LOG_ERROR_MSG("Connection failed");
+
+// Environment variable override supported:
+// LOG_LEVEL=0 (ERROR) ... 3 (DEBUG)
+```
+
## Testing
The project includes a test suite using `minunit`.