You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Following the discussion began here #265, thanks to @hawkw, I was able to successfully spawn a console layer. After that, I tried to build a more complex tracing subscriber which could be set up depending on a YAML configuration + env vars.
Find below, some extracts of the current code (which currently failed to build):
error[E0277]: the trait bound `tracing_subscriber::reload::Layer<tracing::level_filters::LevelFilter, tracing_subscriber::Registry>:__tracing_subscriber_Layer<Layered<impl__tracing_subscriber_Layer<tracing_subscriber::Registry>, tracing_subscriber::Registry>>` is not satisfied
--> src/application/tracing/trace.rs:179:17
|
61 | .with($level_layer)
| ---- required by a bound introduced by this call
...
179 | level_layer,
| ^^^^^^^^^^^ the trait `__tracing_subscriber_Layer<Layered<impl __tracing_subscriber_Layer<tracing_subscriber::Registry>, tracing_subscriber::Registry>>` is not implemented for `tracing_subscriber::reload::Layer<tracing::level_filters::LevelFilter, tracing_subscriber::Registry>`
|
= help: the following implementations were found:
<tracing_subscriber::reload::Layer<L,S>as__tracing_subscriber_Layer<S>>
note: required by a bound in `tracing_subscriber::prelude::__tracing_subscriber_SubscriberExt::with`
--> /home/container/.cargo/registry/src/github.com-1ecc6299db9ec823/tracing-subscriber-0.3.7/src/layer/mod.rs:1065:12
|
1065 | L:Layer<Self>,
| ^^^^^^^^^^^ required by this bound in `tracing_subscriber::prelude::__tracing_subscriber_SubscriberExt::with`
error[E0599]: the method `with` existsfor struct `Layered<tracing_subscriber::reload::Layer<tracing::level_filters::LevelFilter, tracing_subscriber::Registry>,Layered<impl__tracing_subscriber_Layer<tracing_subscriber::Registry>, tracing_subscriber::Registry>>`, but its trait bounds were not satisfied
--> src/application/tracing/trace.rs:62:26
|
62 | .with($subscriber_layer),
| ^^^^ method cannot be called on `Layered<tracing_subscriber::reload::Layer<tracing::level_filters::LevelFilter, tracing_subscriber::Registry>,Layered<impl__tracing_subscriber_Layer<tracing_subscriber::Registry>, tracing_subscriber::Registry>>` due to unsatisfied trait bounds
...
178 | / setup_subscriber!(179 | | level_layer,180 | | subscriber_timer_layer,181 | | format,182 | | *metrics_configuration.get_export().get_tokio().get_enabled()183 | | );
| |_____________- in this macro invocation
|
::: /home/container/.cargo/registry/src/github.com-1ecc6299db9ec823/tracing-subscriber-0.3.7/src/layer/layered.rs:23:1
|
23 | pub struct Layered<L,I,S = I>{
| -------------------------------
| |
| doesn't satisfy `_:SubscriberExt`
| doesn't satisfy `_: tracing::Subscriber`
| doesn't satisfy `_: warp::Filter`
| doesn't satisfy `_: warp::filter::FilterBase`
|
= note: the following trait bounds were not satisfied:
`Layered<tracing_subscriber::reload::Layer<tracing::level_filters::LevelFilter, tracing_subscriber::Registry>,Layered<impl__tracing_subscriber_Layer<tracing_subscriber::Registry>, tracing_subscriber::Registry>>: tracing::Subscriber`
which is required by `Layered<tracing_subscriber::reload::Layer<tracing::level_filters::LevelFilter, tracing_subscriber::Registry>,Layered<impl__tracing_subscriber_Layer<tracing_subscriber::Registry>, tracing_subscriber::Registry>>:SubscriberExt`
`Layered<tracing_subscriber::reload::Layer<tracing::level_filters::LevelFilter, tracing_subscriber::Registry>,Layered<impl__tracing_subscriber_Layer<tracing_subscriber::Registry>, tracing_subscriber::Registry>>: warp::filter::FilterBase`
which is required by `Layered<tracing_subscriber::reload::Layer<tracing::level_filters::LevelFilter, tracing_subscriber::Registry>,Layered<impl__tracing_subscriber_Layer<tracing_subscriber::Registry>, tracing_subscriber::Registry>>: warp::Filter`
`&Layered<tracing_subscriber::reload::Layer<tracing::level_filters::LevelFilter, tracing_subscriber::Registry>,Layered<impl__tracing_subscriber_Layer<tracing_subscriber::Registry>, tracing_subscriber::Registry>>: tracing::Subscriber`
which is required by `&Layered<tracing_subscriber::reload::Layer<tracing::level_filters::LevelFilter, tracing_subscriber::Registry>,Layered<impl__tracing_subscriber_Layer<tracing_subscriber::Registry>, tracing_subscriber::Registry>>:SubscriberExt`
`&Layered<tracing_subscriber::reload::Layer<tracing::level_filters::LevelFilter, tracing_subscriber::Registry>,Layered<impl__tracing_subscriber_Layer<tracing_subscriber::Registry>, tracing_subscriber::Registry>>: warp::filter::FilterBase`
which is required by `&Layered<tracing_subscriber::reload::Layer<tracing::level_filters::LevelFilter, tracing_subscriber::Registry>,Layered<impl__tracing_subscriber_Layer<tracing_subscriber::Registry>, tracing_subscriber::Registry>>: warp::Filter`
`&mutLayered<tracing_subscriber::reload::Layer<tracing::level_filters::LevelFilter, tracing_subscriber::Registry>,Layered<impl__tracing_subscriber_Layer<tracing_subscriber::Registry>, tracing_subscriber::Registry>>: tracing::Subscriber`
which is required by `&mutLayered<tracing_subscriber::reload::Layer<tracing::level_filters::LevelFilter, tracing_subscriber::Registry>,Layered<impl__tracing_subscriber_Layer<tracing_subscriber::Registry>, tracing_subscriber::Registry>>:SubscriberExt`
`&mutLayered<tracing_subscriber::reload::Layer<tracing::level_filters::LevelFilter, tracing_subscriber::Registry>,Layered<impl __tracing_subscriber_Layer<tracing_subscriber::Registry>, tracing_subscriber::Registry>>: warp::filter::FilterBase`
which is required by `&mutLayered<tracing_subscriber::reload::Layer<tracing::level_filters::LevelFilter, tracing_subscriber::Registry>,Layered<impl__tracing_subscriber_Layer<tracing_subscriber::Registry>, tracing_subscriber::Registry>>: warp::Filter`
= note: this error originates in the macro `tracing_setup_subscriber` (inNightly builds, run with -Z macro-backtracefor more info)
error[E0599]: the method `with` exists forstruct `Layered<tracing_subscriber::reload::Layer<tracing::level_filters::LevelFilter, tracing_subscriber::Registry>,Layered<impl__tracing_subscriber_Layer<tracing_subscriber::Registry>, tracing_subscriber::Registry>>`, but its trait bounds were not satisfied
--> src/application/tracing/trace.rs:69:26
|
69 | .with($subscriber_layer.json().flatten_event(true)),
| ^^^^ method cannot be called on `Layered<tracing_subscriber::reload::Layer<tracing::level_filters::LevelFilter, tracing_subscriber::Registry>,Layered<impl __tracing_subscriber_Layer<tracing_subscriber::Registry>, tracing_subscriber::Registry>>` due to unsatisfied trait bounds
...
178 | / setup_subscriber!(179 | | level_layer,180 | | subscriber_timer_layer,181 | | format,182 | | *metrics_configuration.get_export().get_tokio().get_enabled()183 | | );
| |_____________- in this macro invocation
|
::: /home/container/.cargo/registry/src/github.com-1ecc6299db9ec823/tracing-subscriber-0.3.7/src/layer/layered.rs:23:1
|
23 | pub struct Layered<L,I,S = I>{
| -------------------------------
| |
| doesn't satisfy `_:SubscriberExt`
| doesn't satisfy `_: tracing::Subscriber`
| doesn't satisfy `_: warp::Filter`
| doesn't satisfy `_: warp::filter::FilterBase`
|
= note: the following trait bounds were not satisfied:
`Layered<tracing_subscriber::reload::Layer<tracing::level_filters::LevelFilter, tracing_subscriber::Registry>,Layered<impl__tracing_subscriber_Layer<tracing_subscriber::Registry>, tracing_subscriber::Registry>>: tracing::Subscriber`
which is required by `Layered<tracing_subscriber::reload::Layer<tracing::level_filters::LevelFilter, tracing_subscriber::Registry>,Layered<impl__tracing_subscriber_Layer<tracing_subscriber::Registry>, tracing_subscriber::Registry>>:SubscriberExt`
`Layered<tracing_subscriber::reload::Layer<tracing::level_filters::LevelFilter, tracing_subscriber::Registry>,Layered<impl__tracing_subscriber_Layer<tracing_subscriber::Registry>, tracing_subscriber::Registry>>: warp::filter::FilterBase`
which is required by `Layered<tracing_subscriber::reload::Layer<tracing::level_filters::LevelFilter, tracing_subscriber::Registry>,Layered<impl__tracing_subscriber_Layer<tracing_subscriber::Registry>, tracing_subscriber::Registry>>: warp::Filter`
`&Layered<tracing_subscriber::reload::Layer<tracing::level_filters::LevelFilter, tracing_subscriber::Registry>,Layered<impl__tracing_subscriber_Layer<tracing_subscriber::Registry>, tracing_subscriber::Registry>>: tracing::Subscriber`
which is required by `&Layered<tracing_subscriber::reload::Layer<tracing::level_filters::LevelFilter, tracing_subscriber::Registry>,Layered<impl__tracing_subscriber_Layer<tracing_subscriber::Registry>, tracing_subscriber::Registry>>:SubscriberExt`
`&Layered<tracing_subscriber::reload::Layer<tracing::level_filters::LevelFilter, tracing_subscriber::Registry>,Layered<impl__tracing_subscriber_Layer<tracing_subscriber::Registry>, tracing_subscriber::Registry>>: warp::filter::FilterBase`
which is required by `&Layered<tracing_subscriber::reload::Layer<tracing::level_filters::LevelFilter, tracing_subscriber::Registry>,Layered<impl__tracing_subscriber_Layer<tracing_subscriber::Registry>, tracing_subscriber::Registry>>: warp::Filter`
`&mutLayered<tracing_subscriber::reload::Layer<tracing::level_filters::LevelFilter, tracing_subscriber::Registry>,Layered<impl__tracing_subscriber_Layer<tracing_subscriber::Registry>, tracing_subscriber::Registry>>: tracing::Subscriber`
which is required by `&mutLayered<tracing_subscriber::reload::Layer<tracing::level_filters::LevelFilter, tracing_subscriber::Registry>,Layered<impl__tracing_subscriber_Layer<tracing_subscriber::Registry>, tracing_subscriber::Registry>>:SubscriberExt`
`&mutLayered<tracing_subscriber::reload::Layer<tracing::level_filters::LevelFilter, tracing_subscriber::Registry>,Layered<impl __tracing_subscriber_Layer<tracing_subscriber::Registry>, tracing_subscriber::Registry>>: warp::filter::FilterBase`
which is required by `&mutLayered<tracing_subscriber::reload::Layer<tracing::level_filters::LevelFilter, tracing_subscriber::Registry>,Layered<impl__tracing_subscriber_Layer<tracing_subscriber::Registry>, tracing_subscriber::Registry>>: warp::Filter`
= note: this error originates in the macro `tracing_setup_subscriber` (inNightly builds, run with -Z macro-backtracefor more info)
error[E0277]: the trait bound `tracing_subscriber::reload::Layer<tracing::level_filters::LevelFilter, tracing_subscriber::Registry>: __tracing_subscriber_Layer<Layered<impl __tracing_subscriber_Layer<tracing_subscriber::Registry>, tracing_subscriber::Registry>>` is not satisfied
--> src/application/tracing/trace.rs:188:17
|
61 | .with($level_layer)
| ---- required by a bound introduced by this call
...
188 | level_layer,
| ^^^^^^^^^^^ the trait `__tracing_subscriber_Layer<Layered<impl__tracing_subscriber_Layer<tracing_subscriber::Registry>, tracing_subscriber::Registry>>` is not implemented for `tracing_subscriber::reload::Layer<tracing::level_filters::LevelFilter, tracing_subscriber::Registry>`
|
= help: the following implementations were found:<tracing_subscriber::reload::Layer<L,S>as__tracing_subscriber_Layer<S>>
note: required by a bound in `tracing_subscriber::prelude::__tracing_subscriber_SubscriberExt::with`
--> /home/container/.cargo/registry/src/github.com-1ecc6299db9ec823/tracing-subscriber-0.3.7/src/layer/mod.rs:1065:12
|
1065 | L:Layer<Self>,
| ^^^^^^^^^^^ required by this bound in `tracing_subscriber::prelude::__tracing_subscriber_SubscriberExt::with`
error[E0599]: the method `with` exists forstruct `Layered<tracing_subscriber::reload::Layer<tracing::level_filters::LevelFilter, tracing_subscriber::Registry>,Layered<impl__tracing_subscriber_Layer<tracing_subscriber::Registry>, tracing_subscriber::Registry>>`, but its trait bounds were not satisfied
--> src/application/tracing/trace.rs:62:26
|
62 | .with($subscriber_layer),
| ^^^^ method cannot be called on `Layered<tracing_subscriber::reload::Layer<tracing::level_filters::LevelFilter, tracing_subscriber::Registry>,Layered<impl __tracing_subscriber_Layer<tracing_subscriber::Registry>, tracing_subscriber::Registry>>` due to unsatisfied trait bounds
...
187 | / setup_subscriber!(188 | | level_layer,189 | | subscriber_timer_layer,190 | | format,191 | | *metrics_configuration.get_export().get_tokio().get_enabled()192 | | );
| |_____________- in this macro invocation
|
::: /home/container/.cargo/registry/src/github.com-1ecc6299db9ec823/tracing-subscriber-0.3.7/src/layer/layered.rs:23:1
|
23 | pubstructLayered<L,I,S = I>{
| -------------------------------
| |
| doesn't satisfy `_:SubscriberExt`
| doesn't satisfy `_: tracing::Subscriber`
| doesn't satisfy `_: warp::Filter`
| doesn't satisfy `_: warp::filter::FilterBase`
|
= note: the following trait bounds were not satisfied:
`Layered<tracing_subscriber::reload::Layer<tracing::level_filters::LevelFilter, tracing_subscriber::Registry>,Layered<impl__tracing_subscriber_Layer<tracing_subscriber::Registry>, tracing_subscriber::Registry>>: tracing::Subscriber`
which is required by `Layered<tracing_subscriber::reload::Layer<tracing::level_filters::LevelFilter, tracing_subscriber::Registry>,Layered<impl__tracing_subscriber_Layer<tracing_subscriber::Registry>, tracing_subscriber::Registry>>:SubscriberExt`
`Layered<tracing_subscriber::reload::Layer<tracing::level_filters::LevelFilter, tracing_subscriber::Registry>,Layered<impl __tracing_subscriber_Layer<tracing_subscriber::Registry>, tracing_subscriber::Registry>>: warp::filter::FilterBase`
which is required by `Layered<tracing_subscriber::reload::Layer<tracing::level_filters::LevelFilter, tracing_subscriber::Registry>,Layered<impl__tracing_subscriber_Layer<tracing_subscriber::Registry>, tracing_subscriber::Registry>>: warp::Filter`
`&Layered<tracing_subscriber::reload::Layer<tracing::level_filters::LevelFilter, tracing_subscriber::Registry>,Layered<impl__tracing_subscriber_Layer<tracing_subscriber::Registry>, tracing_subscriber::Registry>>: tracing::Subscriber`
which is required by `&Layered<tracing_subscriber::reload::Layer<tracing::level_filters::LevelFilter, tracing_subscriber::Registry>,Layered<impl__tracing_subscriber_Layer<tracing_subscriber::Registry>, tracing_subscriber::Registry>>:SubscriberExt`
`&Layered<tracing_subscriber::reload::Layer<tracing::level_filters::LevelFilter, tracing_subscriber::Registry>,Layered<impl __tracing_subscriber_Layer<tracing_subscriber::Registry>, tracing_subscriber::Registry>>: warp::filter::FilterBase`
which is required by `&Layered<tracing_subscriber::reload::Layer<tracing::level_filters::LevelFilter, tracing_subscriber::Registry>,Layered<impl__tracing_subscriber_Layer<tracing_subscriber::Registry>, tracing_subscriber::Registry>>: warp::Filter`
`&mutLayered<tracing_subscriber::reload::Layer<tracing::level_filters::LevelFilter, tracing_subscriber::Registry>,Layered<impl__tracing_subscriber_Layer<tracing_subscriber::Registry>, tracing_subscriber::Registry>>: tracing::Subscriber`
which is required by `&mutLayered<tracing_subscriber::reload::Layer<tracing::level_filters::LevelFilter, tracing_subscriber::Registry>,Layered<impl__tracing_subscriber_Layer<tracing_subscriber::Registry>, tracing_subscriber::Registry>>:SubscriberExt`
`&mutLayered<tracing_subscriber::reload::Layer<tracing::level_filters::LevelFilter, tracing_subscriber::Registry>,Layered<impl __tracing_subscriber_Layer<tracing_subscriber::Registry>, tracing_subscriber::Registry>>: warp::filter::FilterBase`
which is required by `&mutLayered<tracing_subscriber::reload::Layer<tracing::level_filters::LevelFilter, tracing_subscriber::Registry>,Layered<impl__tracing_subscriber_Layer<tracing_subscriber::Registry>, tracing_subscriber::Registry>>: warp::Filter`
= note: this error originates in the macro `tracing_setup_subscriber` (inNightly builds, run with -Z macro-backtracefor more info)
error[E0599]: the method `with` exists forstruct `Layered<tracing_subscriber::reload::Layer<tracing::level_filters::LevelFilter, tracing_subscriber::Registry>,Layered<impl__tracing_subscriber_Layer<tracing_subscriber::Registry>, tracing_subscriber::Registry>>`, but its trait bounds were not satisfied
--> src/application/tracing/trace.rs:69:26
|
69 | .with($subscriber_layer.json().flatten_event(true)),
| ^^^^ method cannot be called on `Layered<tracing_subscriber::reload::Layer<tracing::level_filters::LevelFilter, tracing_subscriber::Registry>,Layered<impl __tracing_subscriber_Layer<tracing_subscriber::Registry>, tracing_subscriber::Registry>>` due to unsatisfied trait bounds
...
187 | / setup_subscriber!(188 | | level_layer,189 | | subscriber_timer_layer,190 | | format,191 | | *metrics_configuration.get_export().get_tokio().get_enabled()192 | | );
| |_____________- in this macro invocation
|
::: /home/container/.cargo/registry/src/github.com-1ecc6299db9ec823/tracing-subscriber-0.3.7/src/layer/layered.rs:23:1
|
23 | pubstructLayered<L,I,S = I>{
| -------------------------------
| |
| doesn't satisfy `_:SubscriberExt`
| doesn't satisfy `_: tracing::Subscriber`
| doesn't satisfy `_: warp::Filter`
| doesn't satisfy `_: warp::filter::FilterBase`
|
= note: the following trait bounds were not satisfied:
`Layered<tracing_subscriber::reload::Layer<tracing::level_filters::LevelFilter, tracing_subscriber::Registry>,Layered<impl__tracing_subscriber_Layer<tracing_subscriber::Registry>, tracing_subscriber::Registry>>: tracing::Subscriber`
which is required by `Layered<tracing_subscriber::reload::Layer<tracing::level_filters::LevelFilter, tracing_subscriber::Registry>,Layered<impl__tracing_subscriber_Layer<tracing_subscriber::Registry>, tracing_subscriber::Registry>>:SubscriberExt`
`Layered<tracing_subscriber::reload::Layer<tracing::level_filters::LevelFilter, tracing_subscriber::Registry>,Layered<impl __tracing_subscriber_Layer<tracing_subscriber::Registry>, tracing_subscriber::Registry>>: warp::filter::FilterBase`
which is required by `Layered<tracing_subscriber::reload::Layer<tracing::level_filters::LevelFilter, tracing_subscriber::Registry>,Layered<impl__tracing_subscriber_Layer<tracing_subscriber::Registry>, tracing_subscriber::Registry>>: warp::Filter`
`&Layered<tracing_subscriber::reload::Layer<tracing::level_filters::LevelFilter, tracing_subscriber::Registry>,Layered<impl__tracing_subscriber_Layer<tracing_subscriber::Registry>, tracing_subscriber::Registry>>: tracing::Subscriber`
which is required by `&Layered<tracing_subscriber::reload::Layer<tracing::level_filters::LevelFilter, tracing_subscriber::Registry>,Layered<impl__tracing_subscriber_Layer<tracing_subscriber::Registry>, tracing_subscriber::Registry>>:SubscriberExt`
`&Layered<tracing_subscriber::reload::Layer<tracing::level_filters::LevelFilter, tracing_subscriber::Registry>,Layered<impl __tracing_subscriber_Layer<tracing_subscriber::Registry>, tracing_subscriber::Registry>>: warp::filter::FilterBase`
which is required by `&Layered<tracing_subscriber::reload::Layer<tracing::level_filters::LevelFilter, tracing_subscriber::Registry>,Layered<impl__tracing_subscriber_Layer<tracing_subscriber::Registry>, tracing_subscriber::Registry>>: warp::Filter`
`&mutLayered<tracing_subscriber::reload::Layer<tracing::level_filters::LevelFilter, tracing_subscriber::Registry>,Layered<impl__tracing_subscriber_Layer<tracing_subscriber::Registry>, tracing_subscriber::Registry>>: tracing::Subscriber`
which is required by `&mutLayered<tracing_subscriber::reload::Layer<tracing::level_filters::LevelFilter, tracing_subscriber::Registry>,Layered<impl__tracing_subscriber_Layer<tracing_subscriber::Registry>, tracing_subscriber::Registry>>:SubscriberExt`
`&mutLayered<tracing_subscriber::reload::Layer<tracing::level_filters::LevelFilter, tracing_subscriber::Registry>,Layered<impl __tracing_subscriber_Layer<tracing_subscriber::Registry>, tracing_subscriber::Registry>>: warp::filter::FilterBase`
which is required by `&mutLayered<tracing_subscriber::reload::Layer<tracing::level_filters::LevelFilter, tracing_subscriber::Registry>,Layered<impl__tracing_subscriber_Layer<tracing_subscriber::Registry>, tracing_subscriber::Registry>>: warp::Filter`
= note: this error originates in the macro `tracing_setup_subscriber` (inNightly builds, run with -Z macro-backtracefor more info)Some errors have detailed explanations:E0277,E0599.For more information about an error, try `rustc --explain E0277`.
One more thing, I'm able to build the code with console layer if I do the following change in setup_subscriber macro:
I'm closing this issue, since the problem was not coming from the console library. This PR tokio-rs/tracing#2026 made the implementation easier on my side.
Following the discussion began here #265, thanks to @hawkw, I was able to successfully spawn a console layer. After that, I tried to build a more complex tracing subscriber which could be set up depending on a YAML configuration + env vars.
Find below, some extracts of the current code (which currently failed to build):
The interesting part here is when a remove the code related to console layer the code build:
But with the code, I got those issues:
One more thing, I'm able to build the code with console layer if I do the following change in
setup_subscriber
macro:Thanks, in advance for your help.
The text was updated successfully, but these errors were encountered: