From 7f86a166ecd184be80ca0ea38a1fc203fafad0b7 Mon Sep 17 00:00:00 2001 From: strawberry Date: Wed, 24 Apr 2024 01:15:49 -0400 Subject: [PATCH] make "release_max_level_info" into a crate feature Signed-off-by: strawberry --- Cargo.toml | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index fb2dd1c5..90c4f7c9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -158,11 +158,9 @@ features = ["jpeg", "png", "gif", "webp"] [dependencies.log] version = "0.4.21" default-features = false -features = ["max_level_trace", "release_max_level_info"] [dependencies.tracing] version = "0.1.40" default-features = false -features = ["max_level_trace", "release_max_level_info"] [dependencies.tracing-subscriber] version = "0.3.18" features = ["env-filter"] @@ -348,6 +346,7 @@ default = [ "gzip_compression", "brotli_compression", "zstd_compression", + "release_max_log_level", ] backend_sqlite = ["sqlite"] backend_rocksdb = ["rocksdb"] @@ -377,6 +376,17 @@ hot_reload = ["dep:hot-lib-reloader"] hardened_malloc = ["hardened_malloc-rs"] +# increases performance, reduces build times, and reduces binary size by not compiling or +# genreating code for log level filters that users will generally not use (debug and trace) only in release builds +# +# the expense is obviously losing those log level filters for usage at runtime. debug builds will still have all log levels +release_max_log_level = [ + "tracing/max_level_trace", + "tracing/release_max_level_info", + "log/max_level_trace", + "log/release_max_level_info", +] + # developer feature useful only in debug builds. release_log_level = []