dbrgn / tracing-test

Access and evaluate tracing logs in async and sync tests.
Apache License 2.0
52 stars 26 forks source link

Integration tests should see trace from the main crate by default #22

Open sourcefrog opened 1 year ago

sourcefrog commented 1 year ago

I think it would be nice to somehow make the default for integration tests be that it sees trace from the crate under test but not others. It seems like it should be possible, but perhaps it's complicated.

Originally posted by @sourcefrog in https://github.com/dbrgn/tracing-test/issues/20#issuecomment-1410521124

I haven't looked at the implementation yet, but it seems like this ought to be possible?

This would be a nicer default experience and also allow seeing logs from the crate under test but not its dependencies.

dbrgn commented 1 year ago

I haven't yet investigated this issue. Do you know a way to do this reliably?

determine the name of the main crate for the package

If yes, then it should be quite easy to set the filter appropriately.

sourcefrog commented 1 year ago

One way to do it would be to look at https://docs.rs/cargo_metadata/ output, but there might be simpler ways...

AloeareV commented 7 months ago

Failing this, would it be possible to make the filter more configurable than no-env-filter? Even if I need to manually supply (as a macro argument?) the name of the crate(s) I want to get trace-level logs for, it would make the traced test output far more usable than it is currently for integration tests.