Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Have the mock log facade not always print to stdout #510

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

tnull
Copy link
Collaborator

@tnull tnull commented Mar 27, 2025

In #463 we introduced a mock logger that implements the log facade in tests. Previously, it defaulted to always print TRACE-level logs to stdout. This however can be very spammy (especially since it includes TRACE-level logs of electrum_client now).

Here, we make printing the log lines optional by cfg-gating it.

(cc @enigbe)

@@ -48,6 +48,7 @@ impl LogFacadeLog for MockLogFacadeLogger {
record.line().unwrap(),
record.args()
);
#[cfg(ldk_node_test_log_print)]
Copy link
Contributor

Choose a reason for hiding this comment

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

isn't the real problem that we have trace level logs as default for tests?
Cant we work with debug level logs for tests?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I guess we could also consider reducing it, but more generally there is no value in having the MockLogFacadeLogger spamming stdout, as we're really only using it to test our logging interface.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think we can reduce the log level and cfg-gate it so it does not clutter stdout.

@tnull tnull removed the request for review from joostjager March 28, 2025 08:57
Copy link
Contributor

@enigbe enigbe left a comment

Choose a reason for hiding this comment

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

Whatever you decide regarding the log level change is fine by me. The gating LGTM.

@tnull tnull requested a review from G8XSU March 31, 2025 08:38
In lightningdevkit#463 we introduced a mock logger that implements the `log` facade in
tests. Previously, it defaulted to always print `TRACE`-level logs to
`stdout`. This however can be very spammy (especially since it includes
TRACE-level logs of `electrum_client` now).

Here, we make printing the log lines optional by `cfg`-gating it.
@tnull tnull force-pushed the 2025-03-test-log-print-cfg branch from f3d9dce to e5057f5 Compare April 8, 2025 11:46
@tnull
Copy link
Collaborator Author

tnull commented Apr 8, 2025

Rebased to resolve minor conflict.

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