HomePhorge

Fix signature of `Logger.debug()`

Description

Fix signature of Logger.debug()

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.

Reviewers: mollekopf, sicherha

Reviewed By: sicherha

Subscribers: ghane

Differential Revision: https://git.kolab.org/D3944

Details

Provenance
sicherhaAuthored on Nov 6 2022, 6:20 PM
sicherhaPushed on Dec 28 2022, 9:37 PM
Reviewer
sicherha
Differential Revision
D3944: Fix signature of `Logger.debug()`
Parents
rP0b08de125411: TypeError: an integer is required / T6989 Bugs logged for pykolab
Branches
Unknown
Tags
Unknown
Build Status
Buildable 40970