[PR #2954] [MERGED] Add dev-only query logging support #3166

Closed
opened 2026-02-05 05:16:03 +03:00 by OVERLORD · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/dani-garcia/vaultwarden/pull/2954
Author: @BlackDex
Created: 12/3/2022
Status: Merged
Merged: 12/5/2022
Merged by: @dani-garcia

Base: mainHead: sql-debugging


📝 Commits (1)

  • 1b64b9e Add dev-only query logging support

📊 Changes

5 files changed (+46 additions, -8 deletions)

View changed files

📝 Cargo.lock (+11 -0)
📝 Cargo.toml (+6 -0)
📝 build.rs (+13 -8)
📝 src/db/mod.rs (+8 -0)
📝 src/main.rs (+8 -0)

📄 Description

This PR adds query logging support as an optional feature. It is only allowed during development/debug builds, and will abort when used during a --release build.

For this feature to be fully activated you also need to se an environment variable QUERY_LOGGER=1 to activate the debug log-level for this crate, else there will be no output.

The reason for this PR is that sometimes it is useful to be able to see the generated queries, like when debugging an issue, or trying to optimize a query. Currently i always added this code when needed, but having this a part of the code could benifit other developers too who maybe need this.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/dani-garcia/vaultwarden/pull/2954 **Author:** [@BlackDex](https://github.com/BlackDex) **Created:** 12/3/2022 **Status:** ✅ Merged **Merged:** 12/5/2022 **Merged by:** [@dani-garcia](https://github.com/dani-garcia) **Base:** `main` ← **Head:** `sql-debugging` --- ### 📝 Commits (1) - [`1b64b9e`](https://github.com/dani-garcia/vaultwarden/commit/1b64b9e1644d5e07d674d29d83c5e7e58e8f0a2b) Add dev-only query logging support ### 📊 Changes **5 files changed** (+46 additions, -8 deletions) <details> <summary>View changed files</summary> 📝 `Cargo.lock` (+11 -0) 📝 `Cargo.toml` (+6 -0) 📝 `build.rs` (+13 -8) 📝 `src/db/mod.rs` (+8 -0) 📝 `src/main.rs` (+8 -0) </details> ### 📄 Description This PR adds query logging support as an optional feature. It is only allowed during development/debug builds, and will abort when used during a `--release` build. For this feature to be fully activated you also need to se an environment variable `QUERY_LOGGER=1` to activate the debug log-level for this crate, else there will be no output. The reason for this PR is that sometimes it is useful to be able to see the generated queries, like when debugging an issue, or trying to optimize a query. Currently i always added this code when needed, but having this a part of the code could benifit other developers too who maybe need this. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
OVERLORD added the pull-request label 2026-02-05 05:16:03 +03:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/vaultwarden#3166