M
Modular•5mo ago
toasty

Stump: Bound logger library

Hello all! stump is very much a work in progress, but it's a bound logger library inspired by Python's structlog and Golang's log packages. It works by wrapping structs that adhere to the Logger trait in a BoundLogger which handles formatting and styling the message and context data. The library comes with a few common ones, namely a print logger, stdout logger, and file logger. The print logger is of course, extremely slow. But the STDLogger struct is almost as fast as a standard print that applies no formatting or styling at all. I recently revived it so it's now operational using the latest Mojo nightly. Dict.pop() is still broken, so I had to figure out a workaround. Morrow has also not been updated for a few versions, so there was a regression in datetime formatting as I had to fork it and try updating it myself. The formatting is almost done, but for now only isoformat is in use. https://github.com/thatstoasty/stump/tree/nightly Please feel free to test it out and break it as I'm sure there's a bunch of use cases I did not consider 🫡 I hope the file scope var segfaulting gets fixed soon, so this can actually exist as a .mojopkg instead of having to copy the code into your repo!
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server