Skip to content

Conversation

@pvital
Copy link
Member

@pvital pvital commented Oct 10, 2024

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.

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>
@pvital pvital requested review from CagriYonca and GSVarsha October 10, 2024 13:38
@pvital pvital self-assigned this Oct 10, 2024
@pvital pvital added bug legacy_2.x Issues and PRs related to the legacy 2.x series. labels Oct 10, 2024
Copy link
Contributor

@GSVarsha GSVarsha left a comment

Choose a reason for hiding this comment

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

Looks good to me!

Copy link
Contributor

@CagriYonca CagriYonca left a comment

Choose a reason for hiding this comment

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

LGTM

@pvital pvital merged commit aaa03d4 into legacy_2.x Oct 15, 2024
@pvital pvital deleted the fix_logging_multiple_stacklevel_2.x branch October 15, 2024 14:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug legacy_2.x Issues and PRs related to the legacy 2.x series.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants