From d336f88eeeef99ec8a12194a12a3cbfcf9330898 Mon Sep 17 00:00:00 2001 From: Hans Meine Date: Tue, 19 Sep 2023 18:26:49 +0200 Subject: [PATCH] explicitly mention compile-time options of logging crates for code-size reduction --- src/reference/code-size.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/reference/code-size.md b/src/reference/code-size.md index 107cfef8..6c3a45bc 100644 --- a/src/reference/code-size.md +++ b/src/reference/code-size.md @@ -220,6 +220,11 @@ code sizes. `format!`, `to_string`, etc... can bring in a lot of code bloat. If possible, only do string formatting in debug mode, and in release mode use static strings. +Note that the common `tracing` and `log` crates [support compile-time +filters](https://docs.rs/tracing/latest/tracing/level_filters/index.html) that +allow to make logging macros compile to nothing (either depending on the log +level or completely). + ### Avoid Panicking This is definitely easier said than done, but tools like `twiggy` and manually