Skip to content
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

Merged
merged 6 commits into from
Feb 7, 2023
Merged

[COR-145] Log SQL Statements at Debug Level #84

merged 6 commits into from
Feb 7, 2023

Conversation

ianstanton
Copy link
Member

@ianstanton ianstanton commented Feb 6, 2023

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.

@ianstanton ianstanton marked this pull request as ready for review February 6, 2023 22:18
@@ -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 {
Copy link
Member

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.

Copy link
Member

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

Copy link
Member Author

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

@ianstanton ianstanton merged commit 32be6f7 into main Feb 7, 2023
@ianstanton ianstanton deleted the cor-145 branch February 7, 2023 02:41
sjmiller609 pushed a commit that referenced this pull request Dec 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants