-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[COR-145] Log SQL Statements at Debug Level #84
Conversation
@@ -329,7 +329,7 @@ async fn test_database_error_modes() { | |||
// we expect a database error | |||
match queue { | |||
Err(e) => { | |||
if let pgmq::errors::PgmqError::DatabaseError { .. } = e { | |||
if let pgmq::errors::PgmqError::UrlParsingError { .. } = e { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you add a test that covers the DatabaseError
case? I think it would look something like:
- provided a VALID database connection string, but with either wrong host or password,
pgmq::errors::PgmqError::DatabaseError
is returned.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Keep the existing test that makes sure DatabaseError
happens when its the wrong, but valid, connection string.
Add new test that validates that a poorly formed connection string returns UrlParsingError
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, I'll add that
By default, sqlx logs SQL statements at info level. This can become very noisy in application logs. This PR allows us to configure the log level by adding
PgConnectOptions
.For now, we'll set
options.log_statements(LevelFilter::Debug);
and allow for user configurable log level in a follow-up PR.