Structured logging for Sigil.
- Scheme 100%
|
David Wilson
56e4fc5a52
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
Update the package version, Sigil compatibility range, and sigil-json dependency range for the 0.16 ecosystem alignment. Verification: - /tmp/sigil-t-e6e9/build/dev/bin/sigil deps install --redirects /tmp/apiary-016-redirects.sgl - /tmp/sigil-t-e6e9/build/dev/bin/sigil build --redirects /tmp/apiary-016-redirects.sgl - /tmp/sigil-t-e6e9/build/dev/bin/sigil test |
||
|---|---|---|
| src/sigil | sigil-log,sigil-mcp: make logging non-fatal on format/port failure | |
| test | sigil-log,sigil-mcp: make logging non-fatal on format/port failure | |
| .gitignore | Extract sigil-log from sigil monorepo | |
| .woodpecker.yml | Bump CI pin to sigil v0.14.3 | |
| dev-redirects.sgl | Extract sigil-log from sigil monorepo | |
| manifest.scm | Extract sigil-log from sigil monorepo | |
| package.sgl | Bump sigil-log to Sigil 0.16 | |
| README.md | Extract sigil-log from sigil monorepo | |
| sigil.lock | Fix sigil-log 0.15 metadata conflict | |
sigil-log
Structured logging for Sigil.
Provides configurable log levels, text and JSON output formats, per-module filtering, and lazy macros that skip evaluation when the level is inactive.
This package was extracted from the sigil monorepo — the in-tree history
under packages/sigil-log/ is preserved here as master.
Usage
(import (sigil log))
(log-info "Server started" port: 8080)
(log-warn "Slow query" duration-ms: 1200)
(log-error "Request failed" path: "/api" status: 500)
;; Switch output format, raise/lower level
(log-configure! level: 'debug format: 'json)
;; Lazy macros — the argument expressions are not evaluated if the
;; current level suppresses the call site.
(log-debug* "result" value: (expensive-computation))
API
(sigil log)
| Procedure / macro | Purpose |
|---|---|
log-configure! |
Set level, format, output target |
log-configure-from-args! |
Parse --log-level / --log-format from a CLI argv |
log-trace / log-debug / log-info / log-warn / log-error / log-fatal |
Emit at level |
log-trace* / log-debug* / log-info* / log-warn* / log-error* / log-fatal* |
Lazy variants — skip argument evaluation when level inactive |
log-level-active? |
Query whether a level would be emitted |
current-log-level |
Return the currently configured level |
Levels, low to high: trace, debug, info, warn, error, fatal.
Dependencies
sigil-stdlibsigil-json
Both are workspace siblings in the sigil monorepo and are consumed here
as from-git refs pinned to ^0.13.0.
Build
sigil deps install
sigil build
Testing
sigil test
License
BSD-3-Clause.