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.
Issue #, if available: #7
Description of changes:
The Logger class is being monkey patched to use the telemetry logger when logging to
stdout
and/orstderr
. There is a fallback to use the original logger when thelogdev
is not any of these targets (i.e. when it is a file name or IO object) but this fallback is not setting the names of the named parameters to theinitialize
call so it fails with error message:Just adding the names to the named parameters fails with the error message
stack level too deep
which would indicate that the method is already being patched usingModule#prepend
. Usingmethod_alias
andModule#prepend
on a method causes a conflict and eventually a stack overflow.To be able to use prepend, I extracted the logger_patch to a separate module and then apply it with prepend.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.