Futures Poll Log
This crate adds a "inspect" method to all futures, allowing you to tag futures with a name and see all poll calls to them logged.
Usage
Setup a logger through the log
crate. Then use the extension trait:
extern crate futures_poll_log;
use LoggingExt;
let _: = ok
.inspect
.map
.inspect
.and_then
.inspect
.wait;
This will log:
DEBUG - Polling future `failing future'
DEBUG - Polling future `mapped future'
DEBUG - Polling future `immeditate future'
DEBUG - Future `immeditate future' polled: Ok
DEBUG - Future `mapped future' polled: Ok
DEBUG - Future `failing future' polled: Err
Note that it logs the Async state.
Log target
The log target is futures_log
.
Silence
Building the crate with the feature "silence" makes the effect completely vanish, including the intermediate futures. The library also stops binding to log
lib.
This allows you to keep the tagging around for future debugging sessions.
License
MIT