https://linen.dev logo
Log levels
# help
e
Is there a way to set what log level I want to see when using
cargo shuttle logs
? Debug logging is nice sometimes, but when working with a database (I'm using Postgres) every query is laid out in full multiline detail, and unless I'm currently debugging that I really don't need to see it, it really makes it hard to find other parts of the logs. If there's a way to configure the default sqlx logging to not show quite as much detail or with quite as much length multiline verbosity that'd be nice also. :3
g
AFAIK there is no way of doing it yet. The shuttle container uses
RUST_LOG=debug,shuttle=trace,h2=warn
FYI
a
Hey apologies for the long delay in response, basically the main way to do this at the moment is to avoid using the main macro and self-implement everything
e
Ouch 😂
a
It's not as bad as you think 😂 there's an article on it here: https://robertohuertas.com/2023/02/01/shuttle-datadog-logs/
Some bits might need to get changed around as this was from an article from a previous version of shuttle, but yeah
k
So the reason we don't allow users to set the log level currently is that we're not equipped to handle the volume of logs if it's set to trace. Setting the log level higher should be okay though, but we'd need to implement a way to do it.
I have been playing around with an idea of making tracing a resource, and then being able to configure it through the codegen. But I haven't thought about it enough to know if it makes sense yet 🤔
e
As well as log levels, would be nice to be able to set varying filters for what's shown in the logs. SQL logs at debug level are pretty excessive, but I wouldn't mind being able to see the rest of the debug logs tbh. Filtering out anything that comes from for example
sqlx
crate would be pretty nice as well.
g
Yeah so basically like having access to change the RUST_LOG variable without putting the log level too low.
2 Views