Skip to content

Logger fix #8

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

Merged
merged 2 commits into from
Dec 11, 2020
Merged

Logger fix #8

merged 2 commits into from
Dec 11, 2020

Conversation

edhzsz
Copy link
Contributor

@edhzsz edhzsz commented Dec 7, 2020

Issue #, if available: #7

Description of changes:

The Logger class is being monkey patched to use the telemetry logger when logging to stdout and/or stderr. There is a fallback to use the original logger when the logdev 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 the initialize call so it fails with error message:

"errorMessage": "wrong number of arguments (given 9, expected 1..3)",

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 using Module#prepend. Using method_alias and Module#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.

This change also fixes the lack of names of the named parameters on
the fallback to the original Logger.initialize
@edhzsz edhzsz requested review from carlzogh, stefanbotez and zsombor-balogh and removed request for stefanbotez December 7, 2020 13:06
Copy link
Contributor

@carlzogh carlzogh left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Contributor

@stefanbotez stefanbotez left a comment

Choose a reason for hiding this comment

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

LGTM

@stefanbotez stefanbotez merged commit 55a096a into aws:main Dec 11, 2020
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