Page MenuHomePhorge

Fix signature of `Logger.debug()`
ClosedPublic

Authored by sicherha on Nov 6 2022, 6:21 PM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, May 24, 4:52 PM
Unknown Object (File)
Mon, May 20, 8:29 AM
Unknown Object (File)
Sun, May 19, 8:23 PM
Unknown Object (File)
Sat, May 18, 1:25 AM
Unknown Object (File)
Wed, May 15, 5:43 AM
Unknown Object (File)
Apr 27 2024, 2:15 AM
Unknown Object (File)
Apr 26 2024, 10:38 AM
Unknown Object (File)
Apr 21 2024, 5:03 PM
Subscribers

Details

Summary

The default argument level=1 must not come before any positional
arguments; it must be accepted as a keyword argument.
As signified by the pylint comments, the signature previously did not
conform to the specification given in
https://docs.python.org/3/library/logging.html#logging.Logger.debug.

This commit fixes a longstanding problem with crashes occurring in
certain scenarios when the debug level is set to 9. One such crash could
be observed from within SQLAlchemy, which calls debug() in the
following way:
pool.logger.debug("Created new connection %r", connection)
That call caused pykolab's Logger.debug() method to interpret its
second argument as a numeric level, which resulted in a TypeError
because it was actually an sqlite3.Connection.

By accepting level as a keyword argument, all arguments are now
interpreted in the correct order.

Diff Detail

Repository
rP pykolab
Lint
Lint Not Applicable
Unit
Tests Not Applicable