prisma / tiberius

TDS 7.2+ (Microsoft SQL Server) driver for Rust
Apache License 2.0
327 stars 119 forks source link

Opt out of INFO level logs #281

Open lanklaas opened 1 year ago

lanklaas commented 1 year ago

Hello,

When using the bb8 connection pool on a service that is not used frequently, a bunch of connections get opened and closed. This causes my log to be polluted with a lot of connection info messages like below:

 2023-03-23T09:03:38.504951Z  INFO tiberius::client::connection: TLS handshake successful
my-pod-6756bdc984-pbszf my-pod-img 2023-03-23T09:03:38.506484Z  INFO tiberius::tds::stream::token: Database change from 'mydb' to 'master'
my-pod-6756bdc984-pbszf my-pod-img 2023-03-23T09:03:38.506504Z  INFO tiberius::tds::stream::token: Changed database context to 'mydb'.
my-pod-6756bdc984-pbszf my-pod-img 2023-03-23T09:03:38.506510Z  INFO tiberius::tds::stream::token: SQL collation changed to windows-1252
my-pod-6756bdc984-pbszf my-pod-img 2023-03-23T09:03:38.506526Z  INFO tiberius::tds::stream::token: Microsoft SQL Server version 2769289231
my-pod-6756bdc984-pbszf my-pod-img 2023-03-23T09:03:38.506533Z  INFO tiberius::tds::stream::token: Packet size change from '4096' to '4096'

I do not want to filter them out on a global level, but would rather prefer them to be debug events or if the info level is important, then maybe adding a feature flag to set it to debug?

I would be happy to send a PR for this

olback commented 1 year ago

If you're using something like tracing with tracing_subscriber, you can filter the output. https://docs.rs/tracing-subscriber/0.3.17/tracing_subscriber/filter/struct.EnvFilter.html

These messages should be logged at a debug level, not info IMO.