AtlatestRepositorysigil-log
1
# sigil-log3
Structured logging for [Sigil](https://codeberg.org/sigil/sigil).5
Provides configurable log levels, text and JSON output formats, per-module6
filtering, and lazy macros that skip evaluation when the level is inactive.8
This package was extracted from the sigil monorepo — the in-tree history9
under `packages/sigil-log/` is preserved here as `master`.11
## Usage13
```scheme14
(import (sigil log))16
(log-info "Server started" port: 8080)17
(log-warn "Slow query" duration-ms: 1200)18
(log-error "Request failed" path: "/api" status: 500)20
;; Switch output format, raise/lower level21
(log-configure! level: 'debug format: 'json)23
;; Lazy macros — the argument expressions are not evaluated if the24
;; current level suppresses the call site.25
(log-debug* "result" value: (expensive-computation))26
```28
## API30
### `(sigil log)`32
| Procedure / macro | Purpose |33
|-------------------|---------|34
| `log-configure!` | Set level, format, output target |35
| `log-configure-from-args!` | Parse `--log-level` / `--log-format` from a CLI argv |36
| `log-trace` / `log-debug` / `log-info` / `log-warn` / `log-error` / `log-fatal` | Emit at level |37
| `log-trace*` / `log-debug*` / `log-info*` / `log-warn*` / `log-error*` / `log-fatal*` | Lazy variants — skip argument evaluation when level inactive |38
| `log-level-active?` | Query whether a level would be emitted |39
| `current-log-level` | Return the currently configured level |41
Levels, low to high: `trace`, `debug`, `info`, `warn`, `error`, `fatal`.43
## Dependencies45
- `sigil-stdlib`46
- `sigil-json`48
Both are workspace siblings in the sigil monorepo and are consumed here49
as `from-git` refs pinned to `^0.13.0`.51
## Build53
```sh54
sigil deps install55
sigil build56
```58
## Testing60
```sh61
sigil test62
```64
## License66
BSD-3-Clause.