Referencing to https://github.com/launchbadge/sqlx/issues/1874
PgPoolOptions's connect(&str)
expects a database connection string. In order to adapt log level I have to switch to PgConnectOptions
which expects single fields for username, password, host etc.. Therefore it would be nice if PgPoolOptions
supports setting a log level via options.log_statements(LevelFilter::Trace);
the same way as PgConnectOptions
does. Otherwise people have to adapt their configs as well.
All ConnectOptions
types implement FromStr
so you can parse it from the database URL and then modify options as you see fit.
let mut opts: PgConnectOptions = "<database URL>".parse()?;
opts.log_statements(LevelFilter::Trace);