trace: Add static level filtering (#987)

## Motivation

`tokio-trace` should have static verbosity level filtering, like the
`log` crate. The static max verbosity level should be controlled at
compile time with a set of features. It should be possible to set a
separate max level for release and debug mode builds.

## Solution

We can do this fairly similarly to how the `log` crate does it:
`tokio-trace` should export a constant whose value is set based on the
static max level feature flags. Then, we add an if statement to the
`span!` and `event!` macros which tests if that event or span's level
is enabled.

Closes #959
This commit is contained in:
Son
2019-03-25 15:19:20 -07:00
committed by Eliza Weisman
parent 7793d63739
commit 1524ee4b60
8 changed files with 197 additions and 3 deletions
@@ -0,0 +1,10 @@
[workspace]
[package]
name = "test_cargo_max_level_features"
version = "0.1.0"
publish = false
[dependencies.tokio-trace]
path = ".."
features = ["max_level_debug", "release_max_level_info"]