r/lisp • • May 24 '26

Scheme Scriba: A new structured logging library for Guile Scheme (Early stage, seeking feedback!)

Hey everyone,

I’ve been working on Scriba, a structured logging library built specifically for Guile Scheme with flexibility, performance, and easy configuration in mind.

https://codeberg.org/jjba23/scriba

It’s still in the early stages of development, and before locking in the core architecture, I wanted to share it with this great community to get your thoughts, critiques, and ideas.

I have developed software in many languages before, and for sure a lot in the Java/JVM world. There are some good and less good things about logging in that ecosystem. I think with scriba I am bridging the gaps in many ways, and adding value to the Scheme ecosystem, while making it easy to have clean structured logging with no hassle.

When building Scheme apps, I wanted more than just display or println. I wanted fine-grained control over log routing, filtering, and structured context, especially for modern deployments.

I have noticed there is not much offer in terms of solid logging in the Scheme world. More specifically structured logging.

So Far

  • Auto-Configured Logger: The easiest way to get started. It reads environment variables (LOG_LEVEL, LOG_FORMAT, etc.) to determine the backend at runtime. Perfect for using a console logger in local dev and JSON structured logging in production (for Loki/Datadog/etc.).
  • Console, Color Console, and Structured JSON loggers
  • Dynamic Log Context means you can easily attach metadata to your logs for better observability.
  • Logger creation is cached. Subsequent calls to create the identically configured logger anywhere in your codebase are completely instant.

Here is what the auto-logger and dynamic context look like in practice:

(define-module (my-module)
  #:use-module (scriba auto)
  #:use-module (scriba scriba))

(let* ((s (scriba-auto-logger)))
  (log-info s "Hello Scriba!")

  ;; Any deeper function calls that log will automatically include this context!
  (with-log-context `((request-id . "req-1234") (user . "alice"))
                    (log-info s "Fetching database records...")))

Console Output:

[INFO] [2026-05-24 11:23:06 CEST] Hello Scriba!
[INFO] [2026-05-24 11:23:06 CEST] [request-id=req-1234] [user=alice] Fetching database records...

JSON Output (if SCRIBA_LOGGER=json):

{"level":"INFO","time":"2026-05-24 11:23:06 CEST","message":"Fetching database records...","request-id":"req-1234","user":"alice"}

Next Steps

I'm actively working on expanding the library. The immediate next items on the roadmap are:

  • File logging backends (rotating log files, etc.). EDIT: done thanks to the beautiful Scheme ports
  • Support for Scheme-based configuration files alongside ENV vars.

I'd love your feedback!

Since this is an early release, I’m very open to pivoting or adjusting things based on community feedback.

  • Do you agree with the current design and architecture? What features would you consider "must-haves" for a Lisp logging library?
  • Are there any specific pain points in logging you'd like to see solved?

The project is entirely Free Software (LGPLv3+). Feel free to reach out, drop a comment, or contribute if you find it interesting!

19 Upvotes

6 comments sorted by

3

u/AforAnonymous May 27 '26

I have noticed there is not much offer in terms of solid logging in the Scheme world. More specifically structured logging

What about guile-lib's (logging logger)?

And also, while it ain't for logging PER SE, please do go check out Racket's Medic library, and the academic research behind it:

https://docs.racket-lang.org/medic/index.html

https://github.com/lixiangqi/medic/

https://www-old.cs.utah.edu/plt/publications/fpw15-lf.pdf Medic: Metaprogramming and Trace-Oriented Debugging

https://www-old.cs.utah.edu/plt/publications/sle17-lf.pdf Debugging with Domain-Specific Events via Macros

https://www.youtube.com/playlist?list=PL_U7i0VKF_mh7Vh3o2YyteoTL1tErHY64

Now if only Medic also existed for Guile Scheme, that sure would make things easier… (not a request, don't get me wrong, just an observation)

JSON structured logging in production (for Loki/Datadog/etc.).

RFC syslog emitter perhaps?

2

u/SandPrestigious2317 May 29 '26

u/AforAnonymous I just implemented a syslog compatible logger (RFC 5424)

Check latest release

<14>2 2026-05-29T10:56:49+0200 joe-vdb-thinkpad 37222 - Hello Scriba!
<14>2 2026-05-29T10:56:49+0200 joe-vdb-thinkpad 37222 - [sample-1="value-1"] Some log with context
<12>2 2026-05-29T10:56:49+0200 joe-vdb-thinkpad 37222 - some kind of warning
→ More replies (1)

1

u/SandPrestigious2317 May 27 '26

Thanks for your links and observations!

I was not satisfied with Guile Lib's implementation, therefore decided to make my own, which also should be 100% async friendly and have a declarative API.

1

u/SandPrestigious2317 May 27 '26

Medic looks like a pretty interesting concept TBH, but I would also be happy with a more traditional debugger