Skip Navigation
InitialsDiceBearhttps://github.com/dicebear/dicebearhttps://creativecommons.org/publicdomain/zero/1.0/„Initials” (https://github.com/dicebear/dicebear) by „DiceBear”, licensed under „CC0 1.0” (https://creativecommons.org/publicdomain/zero/1.0/)MO
MoSal @lemmyrs.org

https://github.com/MoSal

Posts 0
Comments 3
*Permanently Deleted*
  • It's weird how much difference a year makes in the Rust world. I had some initial pushback in this PR from 11 months ago, which only expanded the scope of recommendation for tracking Cargo.lock a little.

  • *Permanently Deleted*
  • This is not how the resolver works. A comment from the GitHub thread explains it well:

    Cargo.lock is not active when you simply use some software, for libraries used as a dependency it's completely ignored, for applications installed via cargo install it's ignored by default but can be enabled with cargo install --locked. Only when you are building from within the source tree is it active (e.g. via cloning the repo, or manually downloading and extracting the archive).

  • Trying to add a second logging target for Lemmy 0.18.2 Rust code
  • I think tracing-appender is not directly relevant here.

    Never touched tracing layers before. But I think this may help you:

    EnvFilter implements both the Layer and Filter traits, so it may be used for both global filtering and per-layer filtering, respectively. See the documentation on filtering with Layers for details.

    https://docs.rs/tracing-subscriber/latest/tracing_subscriber/filter/struct.EnvFilter.html

    So adding a filter with <custom-target>=<log-level> to your custom layer should work.

    Example:

    use tracing_subscriber::{fmt, EnvFilter, prelude::*};
    
    fn main() {
        let custom_layer = fmt::layer()
            .with_writer(|| std::io::stderr())
            // EnvFilter as a Filter
            .with_filter(EnvFilter::try_new("custom_target=info").unwrap());
    
        tracing_subscriber::registry()
            // EnvFilter as a Layer
            .with(EnvFilter::try_new("info").unwrap())
            .with(fmt::layer()) // default
            .with(custom_layer) // custom
            .init();
    
        tracing::info!("default target");
        tracing::info!(target:"custom_target", "custom target");
    }
    

    Here the default layer is using the default writer to stdout, while the custom one is writing to stderr.