aboutsummaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
authorBlackDex <[email protected]>2023-03-09 16:31:28 +0100
committerBlackDex <[email protected]>2023-03-11 16:58:32 +0100
commit9e5b94924f5fea4ef405fa1f8aeb836b52f85a73 (patch)
tree83dcde146ea7557e0ef0a3209d681128a6dbc803 /src/main.rs
parentf21089900e86274c8a89a15a6ff79dfb9c433ca2 (diff)
downloadvaultwarden-9e5b94924f5fea4ef405fa1f8aeb836b52f85a73.tar.gz
vaultwarden-9e5b94924f5fea4ef405fa1f8aeb836b52f85a73.zip
Merge ClientIp with Headers.
Since we now use the `ClientIp` Guard on a lot more places, it also increases the size of binary, and the macro generated code because of this extra Guard. By merging the `ClientIp` Guard with the several `Header` guards we have it reduces the amount of code generated (including LLVM IR), but also a small speedup in build time. I also spotted some small `json!()` optimizations which also reduced the amount of code generated.
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/main.rs b/src/main.rs
index e61f7cf1..b85b8900 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -250,6 +250,14 @@ fn init_logging(level: log::LevelFilter) -> Result<(), fern::InitError> {
log::LevelFilter::Off
};
+ // Only show rocket underscore `_` logs when the level is Debug or higher
+ // Else this will bloat the log output with useless messages.
+ let rocket_underscore_level = if level >= log::LevelFilter::Debug {
+ log::LevelFilter::Warn
+ } else {
+ log::LevelFilter::Off
+ };
+
let mut logger = fern::Dispatch::new()
.level(level)
// Hide unknown certificate errors if using self-signed
@@ -257,7 +265,7 @@ fn init_logging(level: log::LevelFilter) -> Result<(), fern::InitError> {
// Hide failed to close stream messages
.level_for("hyper::server", log::LevelFilter::Warn)
// Silence rocket logs
- .level_for("_", log::LevelFilter::Warn)
+ .level_for("_", rocket_underscore_level)
.level_for("rocket::launch", log::LevelFilter::Error)
.level_for("rocket::launch_", log::LevelFilter::Error)
.level_for("rocket::rocket", log::LevelFilter::Warn)
@@ -269,7 +277,8 @@ fn init_logging(level: log::LevelFilter) -> Result<(), fern::InitError> {
// Prevent cookie_store logs
.level_for("cookie_store", log::LevelFilter::Off)
// Variable level for trust-dns used by reqwest
- .level_for("trust_dns_proto", trust_dns_level)
+ .level_for("trust_dns_resolver::name_server::name_server", trust_dns_level)
+ .level_for("trust_dns_proto::xfer", trust_dns_level)
.level_for("diesel_logger", diesel_logger_level)
.chain(std::io::stdout());
@@ -277,9 +286,9 @@ fn init_logging(level: log::LevelFilter) -> Result<(), fern::InitError> {
// This can contain sensitive information we do not want in the default debug/trace logging.
if CONFIG.smtp_debug() {
println!(
- "[WARNING] SMTP Debugging is enabled (SMTP_DEBUG=true). Sensitive information could be disclosed via logs!"
+ "[WARNING] SMTP Debugging is enabled (SMTP_DEBUG=true). Sensitive information could be disclosed via logs!\n\
+ [WARNING] Only enable SMTP_DEBUG during troubleshooting!\n"
);
- println!("[WARNING] Only enable SMTP_DEBUG during troubleshooting!\n");
logger = logger.level_for("lettre::transport::smtp", log::LevelFilter::Debug)
} else {
logger = logger.level_for("lettre::transport::smtp", log::LevelFilter::Off)