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

Adapt to logger's incoming stacklevel #660

Merged
merged 2 commits into from
Oct 28, 2024

Conversation

GSVarsha
Copy link
Contributor

Related to #652

Bypass the stack level of our instrumentation when the keyword stacklevel is set as well.

Before the changes py3.11

log_with_instana -> log_custom_warning -> main
stacklevel1 -> stacklevel2 -> stacklevel3

After the changes py3.11

log_custom_warning -> main -> test_log_caller_with_stacklevel
stacklevel1 -> stacklevel2 -> stacklevel3

pvital and others added 2 commits October 28, 2024 09:28
The error `_log() got multiple values for keyword argument 'stacklevel'`
may occur when you pass both a positional argument and a keyword
argument with the same name (`stacklevel`) to the `Logger._log()`
function.

This fix checks if the `stacklevel` is a key of the `kwargs` dictionary
before calling the `Logger._log()` function, considering it if present.

Signed-off-by: Paulo Vital <paulo.vital@ibm.com>
(cherry picked from commit aaa03d4)
Signed-off-by: Varsha GS <varsha.gs@ibm.com>
@GSVarsha GSVarsha added this to the H2-2024 milestone Oct 28, 2024
@GSVarsha GSVarsha self-assigned this Oct 28, 2024
@GSVarsha GSVarsha requested review from pvital and CagriYonca October 28, 2024 04:26
Copy link
Member

@pvital pvital left a comment

Choose a reason for hiding this comment

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

It looks good to me.

@GSVarsha GSVarsha merged commit 288029b into master Oct 28, 2024
12 of 13 checks passed
@GSVarsha GSVarsha deleted the adapt_logging_incoming_stacklevel branch October 28, 2024 09:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants