summaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
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`.