melpomene: make tracing
feature flags additive
#1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently, the
tracing
behavior in Melpomene is controlled by a pairof feature flags, "trace-modality" and "trace-fmt". These select between
emitting traces to stdout using
tracing_subscriber::fmt
, and emittingto Modality using the
tracing-modality
crate. However, these featureflags are not additive. If they are both enabled, the code will not
compile, since there are two implementations of the
setup_tracing
function, which are conditionally compiled based on whether those
feature flags are enabled. If both are enabled, both functions will be
present, resulting in a compiler error.
This commit changes this code so that there is a single implementation
of the
setup_tracing
function, which will construct atracing
subscriber that includes either
fmt
, Modality, or both, depending onthe feature combination. Now, Melpomene should build even with
--all-features
or similar.Now that the
fmt
layer is built manually rather than usingfmt::init()
"easy mode" helper, I've also changed the filterenvironment variable from "RUST_LOG" to "MELPOMENE_TRACE". I thought
this was nicer, but we can continue using the default env var if that's
preferable.