Skip to content

[WIP] include std::log output in tracing output - #584

Closed
nothingmuch wants to merge 1 commit into
payjoin:masterfrom
nothingmuch:log-in-tracing
Closed

nothingmuch wants to merge 1 commit into
payjoin:masterfrom
nothingmuch:log-in-tracing

Conversation

@nothingmuch

Copy link
Copy Markdown
Contributor

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)

@coveralls

coveralls commented Mar 16, 2025 •

Copy link
Copy Markdown
Collaborator

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%
Totals Coverage Status
Change from base Build 13875410498: 0.007%
Covered Lines: 4837
Relevant Lines: 6020

💛 - Coveralls

Uses the tracing-log dependency, which is already in the tree due to
tracing-subscriber
@DanGould

Copy link
Copy Markdown
Member

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

DanGould commented Mar 17, 2025 •

Copy link
Copy Markdown
Member

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.

@arminsabouri

Copy link
Copy Markdown
Contributor

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

@nothingmuch

Copy link
Copy Markdown
Contributor Author

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 nothingmuch mentioned this pull request Aug 29, 2025
2 tasks done
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

Successfully merging this pull request may close these issues.

4 participants