Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

annot infer type of the type parameter S declared on the function layer #3117

Open
TheGP opened this issue Oct 23, 2024 · 1 comment
Open

Comments

@TheGP
Copy link

TheGP commented Oct 23, 2024

error[E0282]: type annotations needed
   --> src/main.rs:159:22
    |
159 |     let console_layer = tracing_subscriber::fmt::layer()
    |                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type of the type parameter `S` declared on the function `layer`
    |
help: consider specifying the generic argument
    |
159 |     let console_layer = tracing_subscriber::fmt::layer::<S>()
let (non_blocking_console, console_guard) = tracing_appender::non_blocking(std::io::stdout());
let console_layer = tracing_subscriber::fmt::layer()
        .with_writer(non_blocking_console)
        .with_ansi(true)
        .with_target(false)
        .with_span_events(FmtSpan::CLOSE)
        .with_filter(filter::LevelFilter::INFO);
``
@kaffarell
Copy link
Contributor

Check this section: https://docs.rs/tracing-subscriber/latest/tracing_subscriber/layer/index.html#composing-layers. Either you specify the subscriber or you add the layer to a subscriber, f.e. to the registry.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants