Skip to content

Treat null Logger as no-op in ctx()#7

Merged
merlimat merged 1 commit intomainfrom
wt/romantic-hertz-6ec476
Apr 28, 2026
Merged

Treat null Logger as no-op in ctx()#7
merlimat merged 1 commit intomainfrom
wt/romantic-hertz-6ec476

Conversation

@merlimat
Copy link
Copy Markdown
Owner

Summary

  • LoggerBuilder.ctx(Logger) and Event.ctx(Logger) now return early when passed null instead of throwing NullPointerException.
  • Aligns the null path with the existing empty-logger no-op behavior, useful when callers pass an optional context logger that may be unset.
  • Javadoc on both interface methods updated to document the null behavior.

Test plan

  • New tests ctxWithNullLoggerIsNoOp and eventCtxWithNullLoggerIsNoOp added alongside the existing empty-logger tests.
  • ./gradlew test passes.

Avoids NullPointerException when callers pass an optional context
logger that may be unset. The empty-logger path was already a no-op;
this aligns the null path with the same behavior.
@merlimat merlimat merged commit c6410ba into main Apr 28, 2026
7 checks passed
@merlimat merlimat deleted the wt/romantic-hertz-6ec476 branch April 28, 2026 23:34
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.

1 participant