Skip to content

Conversation

@joostjager
Copy link
Contributor

@joostjager joostjager commented Nov 18, 2025

This PR further reduces duplication of data between log messages and structured log fields. The selection of log statements to de-duplicate was determined by running the test suite, tracking all log outputs, and distilling that down to the log lines that for every invocation had the duplication in them.

It is the case that some log statements, depending on the caller, do not always have the right context attached. Those were left unchanged for now and can be reworked incrementally.

Follow up from #4217

@ldk-reviews-bot
Copy link

ldk-reviews-bot commented Nov 18, 2025

👋 Thanks for assigning @TheBlueMatt as a reviewer!
I'll wait for their review and will help manage the review process.
Once they submit their review, I'll check if a second reviewer would be helpful.

Copy link
Collaborator

@TheBlueMatt TheBlueMatt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some commit messages and updates to the logger docs to note that these things aren't included like we did channel id would be nice, otherwise lgtm.

@TheBlueMatt TheBlueMatt removed the request for review from valentinewallace November 18, 2025 14:41
@codecov
Copy link

codecov bot commented Nov 18, 2025

Codecov Report

❌ Patch coverage is 78.47222% with 31 lines in your changes missing coverage. Please review.
✅ Project coverage is 89.32%. Comparing base (21110c8) to head (a6812c8).
⚠️ Report is 18 commits behind head on main.

Files with missing lines Patch % Lines
lightning/src/ln/channelmanager.rs 81.08% 20 Missing and 1 partial ⚠️
lightning/src/ln/peer_handler.rs 69.69% 10 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4228      +/-   ##
==========================================
- Coverage   89.33%   89.32%   -0.01%     
==========================================
  Files         180      180              
  Lines      138353   138502     +149     
  Branches   138353   138502     +149     
==========================================
+ Hits       123598   123720     +122     
- Misses      12132    12157      +25     
- Partials     2623     2625       +2     
Flag Coverage Δ
fuzzing 35.97% <53.47%> (+0.06%) ⬆️
tests 88.69% <75.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Now that the default Display implementation of Record also outputs
structured log fields, that data can be removed from the log messages.
This declutters the log output and also helps with verticality in the
code.

Note that deduplication is only carried out for log statements that are
always called in a log context. For some statements this isn't the case
because not every caller sets up the context. Those are left unchanged.
@joostjager
Copy link
Contributor Author

Comment on lines +7493 to +7496
"Forwarding HTLC from SCID {} with next hop SCID {} over {}",
prev_outbound_scid_alias,
short_chan_id,
channel_description
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be nice to do the inline thing here and in many places.

Suggested change
"Forwarding HTLC from SCID {} with next hop SCID {} over {}",
prev_outbound_scid_alias,
short_chan_id,
channel_description
"Forwarding HTLC from SCID {prev_outbound_scid_alias} with next hop SCID {short_chan_id} over {channel_description}",

log_debug!(logger, "Peer {} does not support static remote key, disconnecting", log_pubkey!(counterparty_node_id));
log_debug!(
logger,
"Peer {} does not support static remote key, disconnecting",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: you can definitely drop the pubkey here as well.

@ldk-reviews-bot
Copy link

👋 The first review has been submitted!

Do you think this PR is ready for a second reviewer? If so, click here to assign a second reviewer.

@TheBlueMatt TheBlueMatt merged commit 6d9c676 into lightningdevkit:main Nov 19, 2025
25 checks passed
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.

3 participants