Conversation
Copilot
AI
changed the title
[WIP] Avoid using console as default logger — breaks structured logging in consuming applications
Remove console as default logger to fix structured logging interference
Sep 9, 2025
antondalgren
approved these changes
Sep 10, 2025
Contributor
antondalgren
left a comment
There was a problem hiding this comment.
I think it does what it's expected to do!
f7f2ed7 to
072ec1e
Compare
072ec1e to
d565b47
Compare
baelter
approved these changes
Sep 11, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The AMQP client library was using
consoleas the default logger, which caused issues for applications using structured logging. Randomconsole.log,console.warn, andconsole.errorcalls from the library would:Solution
This PR changes the default logging behavior to be opt-in rather than automatic:
Key Changes
undefinedinstead ofconsoleinAMQPBaseClientAMQPClientconstructor accepts optionalloggerparameterAMQPWebSocketClientconstructor accepts optionalloggerparameterAMQPWebSocketClientinit object supportsloggerpropertyconsole.infowiththis.logger?.infofor consistencyUsage Examples
Backward Compatibility
?.) so they safely handle null loggerPick<typeof console, 'debug' | 'info' | 'warn' | 'error'>Testing
Added comprehensive test coverage:
Libraries should not log by default unless explicitly configured to do so. This change allows consuming applications to maintain control over their logging strategy while still providing debugging capabilities when needed.
Fixes #143.
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.