AtlatestRepositorysigil-log
1# sigil-log
2
3Structured logging for [Sigil](https://codeberg.org/sigil/sigil).
4
5Provides configurable log levels, text and JSON output formats, per-module
6filtering, and lazy macros that skip evaluation when the level is inactive.
7
8This package was extracted from the sigil monorepo — the in-tree history
9under `packages/sigil-log/` is preserved here as `master`.
11## Usage
13```scheme
14(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 level
21(log-configure! level: 'debug format: 'json)
23;; Lazy macros — the argument expressions are not evaluated if the
24;; current level suppresses the call site.
25(log-debug* "result" value: (expensive-computation))
26```
28## API
30### `(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 |
41Levels, low to high: `trace`, `debug`, `info`, `warn`, `error`, `fatal`.
43## Dependencies
45- `sigil-stdlib`
46- `sigil-json`
48Both are workspace siblings in the sigil monorepo and are consumed here
49as `from-git` refs pinned to `^0.13.0`.
51## Build
53```sh
54sigil deps install
55sigil build
56```
58## Testing
60```sh
61sigil test
62```
64## License
66BSD-3-Clause.