Giter Site home page Giter Site logo

Comments (3)

daboross avatar daboross commented on July 18, 2024 1

@daboross is there a way to get fern to work with tracing in the meantime?

No, not at the moment. I would say to use Dispatch::filter, but log::Metadata only exposes the target, not the originating module.

We might be able to get a fix in on tracing's side, if the fact that they overwrite the target with their own internal one is a bug, rather than a feature. But I haven't tried to contact them about it.

Is this error related to the targets for module level filtering? I think this might be related to this issue: tokio-rs/tracing#1237 in tracing

This is unrelated - looks like it was solved in discussion with the other issue, though! Agreed with the notgull's comment there - it looks like a conflict for the global logger - there can be only one.

You may be able to get this to work without modifications if you can set up fern to receive only messages from tracing-subscriber? I don't know their API too well, but on ferns side at least, it doesn't need to be the global logger.

If you use let (global_level, log) = dispatch.into_log(); instead of .apply() as the final transformation in fern, you'll get a boxed logger which you can feed log entries to put through into fern. It won't consume logs globally anymore, but if you can then set up tracing-log to be registered globally, and forward log entries from that or tracing-subscriber into the fern logger, then both could co-exist.

from fern.

cdesch avatar cdesch commented on July 18, 2024

@daboross is there a way to get fern to work with tracing in the meantime?

from fern.

cdesch avatar cdesch commented on July 18, 2024

I get the error Error: SetLoggerError(()) when trying to use fern with tracing:

cj@cj-Z:~/projects/macro_sandbox|main ⇒  RUST_BACKTRACE=full cargo run                             
   Compiling macro_sandbox v0.1.0 (/home/cj/projects/macro_sandbox)
    Finished dev [unoptimized + debuginfo] target(s) in 1.11s
     Running `target/debug/macro_sandbox`
Hello, world!
Error: SetLoggerError(())
cj@cj-Z:~/projects/macro_sandbox|main ⇒  

Here is a repo that reproduces the error.

Is this error related to the targets for module level filtering? I think this might be related to this issue: tokio-rs/tracing#1237 in tracing

from fern.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.