Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

explicitly mention compile-time options of logging crates for code-size reduction #302

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/reference/code-size.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down