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.
This adds a tracing subscriber to any of our tests but it is behind the env var
FUEL_TRACE
so it doesn't collide with any downstream or custom subscribers.:Usage
To enable tracing for a test, add the following to the lib.rs file of the crate you want to trace:
If you also want tracing in your integration tests, you need to add the above to each integration tests file.
Tracing is still disabled by default so to enable it set the following environment variable:
export FUEL_TRACE=1
Or if you just want it for a single test run:
FUEL_TRACE=1 cargo test
Now you will have error level tracing like:
You can use the
RUST_LOG
environment variable to control the level of tracing you want to see. For example:FUEL_TRACE=1 RUST_LOG=trace cargo test
Additional Subscribers
You can set a few different types of subscribers:
Compact output:
FUEL_TRACE=compact cargo test
Pretty output:
FUEL_TRACE=pretty cargo test
Log to file:
FUEL_TRACE=log-file cargo test
Log to file and output to console:
FUEL_TRACE=log-show cargo test
You can also set the log file path:
FUEL_TRACE_PATH=/some/path FUEL_TRACE=log-file cargo test
If you don't set the path, it will default to
CARGO_MANIFEST_DIR/logs/logfile
.