aboutsummaryrefslogtreecommitdiff
path: root/Cargo.toml
diff options
context:
space:
mode:
authorBlackDex <[email protected]>2022-12-03 18:25:59 +0100
committerBlackDex <[email protected]>2022-12-03 18:36:46 +0100
commit1b64b9e1644d5e07d674d29d83c5e7e58e8f0a2b (patch)
treebd393d9c72a0d5dc98a278ff5ec6d61a2ae59ca5 /Cargo.toml
parent8feed2916fee7a06e82e6df5070a9c4ee042bcd0 (diff)
downloadvaultwarden-1b64b9e1644d5e07d674d29d83c5e7e58e8f0a2b.tar.gz
vaultwarden-1b64b9e1644d5e07d674d29d83c5e7e58e8f0a2b.zip
Add dev-only query logging support
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.
Diffstat (limited to 'Cargo.toml')
-rw-r--r--Cargo.toml6
1 files changed, 6 insertions, 0 deletions
diff --git a/Cargo.toml b/Cargo.toml
index 1f3930c7..c667ab90 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -24,6 +24,11 @@ vendored_openssl = ["openssl/vendored"]
# Enable MiMalloc memory allocator to replace the default malloc
# This can improve performance for Alpine builds
enable_mimalloc = ["mimalloc"]
+# This is a development dependency, and should only be used during development!
+# It enables the usage of the diesel_logger crate, which is able to output the generated queries.
+# You also need to set an env variable `QUERY_LOGGER=1` to fully activate this so you do not have to re-compile
+# if you want to turn off the logging for a specific run.
+query_logger = ["diesel_logger"]
# Enable unstable features, requires nightly
# Currently only used to enable rusts official ip support
@@ -70,6 +75,7 @@ serde_json = "1.0.87"
# A safe, extensible ORM and Query builder
diesel = { version = "2.0.2", features = ["chrono", "r2d2"] }
diesel_migrations = "2.0.0"
+diesel_logger = { version = "0.2.0", optional = true }
# Bundled SQLite
libsqlite3-sys = { version = "0.25.2", features = ["bundled"], optional = true }