Skip to content

Conversation

thatbudakguy
Copy link
Contributor

Although Logger.exception supports passing exception info with exc_info, when you use logging.exception, keyword arguments are not forwarded to the root logger, which makes passing exc_info raise TypeError.


def exception(msg, *args):
getLogger().exception(msg, *args)
def exception(msg, *args, **kwargs):
Copy link
Member

Choose a reason for hiding this comment

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

Would it be better to do:

def exception(msg, *args, exc_info=True):
   getLogger().exception(msg, *args, exc_info)

?

That way it's clear what args are supported. In particular, general keyword args are not supported, only exc_info is.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good idea; I've updated it!

Although `Logger.exception` supports passing exception info with
`exc_info`, when you use `logging.exception` keyword arguments are not
forwarded to the root logger, which makes passing `exc_info` raise
`TypeError`.

Signed-off-by: Nick Budak <[email protected]>
@dpgeorge dpgeorge merged commit 6e24cff into micropython:master Jun 6, 2025
4 checks passed
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.

2 participants