rust-payjoin icon indicating copy to clipboard operation
rust-payjoin copied to clipboard

[WIP] include std::log output in tracing output

Open nothingmuch opened this issue 8 months ago • 3 comments

with the default options, which we use, the tracing-subscriber crate already includes tracing-log as a dependency, so might as well enable the std::log event bridge

opening as a draft primarily to document how this can be done at least crudely. afaict it would be better to have init_tracing return a guard per thread instead of a setting the global in a Once, and use the SubscriberInitExt extension trait's set_default, which would make our tests do let _guard = init_tracing() everywhere.

that's kind of what actually wanted which is to use the tracing-chrome crate so i can look at spans more graphically, still trying to figure out how to save these only if tests fail, or as an alternative set one up for all tests somehow and maybe use #instrument to add a span for per test, or just record them all but only if some env var is set (I would like to have them as downloadable artifacts in github CI jobs)

nothingmuch avatar Mar 16 '25 23:03 nothingmuch

Pull Request Test Coverage Report for Build 13890527789

Details

  • 2 of 2 (100.0%) changed or added relevant lines in 1 file are covered.
  • 2 unchanged lines in 1 file lost coverage.
  • Overall coverage increased (+0.007%) to 80.349%

Files with Coverage Reduction New Missed Lines %
payjoin/src/send/mod.rs 2 94.31%
<!-- Total: 2
Totals Coverage Status
Change from base Build 13875410498: 0.007%
Covered Lines: 4837
Relevant Lines: 6020

💛 - Coveralls

coveralls avatar Mar 16 '25 23:03 coveralls

diff --git a/Cargo-minimal.lock b/Cargo-minimal.lock

index ca59ec8..7848e9b 100644
--- a/Cargo-minimal.lock
+++ b/Cargo-minimal.lock
@@ -1689,6 +1689,7 @@ dependencies = [
  "testcontainers-modules",
  "tokio",
  "tracing",
+ "tracing-log",
  "tracing-subscriber",
  "url",
 ]
diff --git a/Cargo-recent.lock b/Cargo-recent.lock
index ca59ec8..7848e9b 100644
--- a/Cargo-recent.lock
+++ b/Cargo-recent.lock
@@ -1689,6 +1689,7 @@ dependencies = [
  "testcontainers-modules",
  "tokio",
  "tracing",
+ "tracing-log",
  "tracing-subscriber",
  "url",
 ]

had to add tracing-log to the dependency list in the lock file

DanGould avatar Mar 17 '25 02:03 DanGould

~~Checking cargo tree, I think tracing-subscriber is only used as a dev-dep with payjoin-directory, ohttp-relay, and testcontainers. I'm not opposed to adding it but I do think it would entail an additional dependency.~~

wait this is just a test dependency cACK this makes total sense, already a dev dep.

DanGould avatar Mar 17 '25 02:03 DanGould

@nothingmuch Is there anything blocking this? Is this related to #916 ?

arminsabouri avatar Aug 21 '25 13:08 arminsabouri

I would prefer to just switch to tracing in the payjoin crate, which is why I never took this out of draft (that's what I do in my local trees when I want to see the log output from tests)

nothingmuch avatar Aug 29 '25 16:08 nothingmuch