PRQL / prql

PRQL is a modern language for transforming data — a simple, powerful, pipelined SQL replacement
https://prql-lang.org
Apache License 2.0
9.84k stars 216 forks source link

feat: replace env logger with debug log #4663

Closed aljazerzen closed 3 months ago

aljazerzen commented 3 months ago

Instead of logging debug messages to stderr, any log::debug! or log::info! or log::trace! will now log messages into the debug-log.html/debug-log.json.

image

max-sixty commented 3 months ago

The track record of this is very good, so I defer to you even more than usual. :)


I would generally raise an eyebrow at us having our own logging framework, relative to using something that's more standard, since we reimplement a bunch of things ourselves and it raises the bar a bit for newer contributors. FWIW a quick browse suggests there are some well-supported structured logging crates around, such as tracing (+ tracing-appender which allows writing for files).

It is nice to have a single output of logs & stages. That would be more difficult with my (2) suggestion in #4646 of writing the JSON out to a specific file rather than as exhaust, since at least logs are exhaust. So if this is the closest way of getting that, sobeit. If we really want, we can always switch out the bottom layer another time.

aljazerzen commented 3 months ago

Yeah, I was hesitant to do this at first too, but it is not really a logging framework, just a logging backend - a writer to a different location.

I have to try this new development first and then decide if it is any good.


The great potential with thid debug log is that when all the logs are in .html, we even do filtering on the fly. For example, compile the query once, capture all levels and then filter to isolate only the ones that you need.