mirror of
https://github.com/psycopg/psycopg2.git
synced 2025-07-10 16:22:33 +03:00
#1026 added support for logging.LoggerAdapter
This commit is contained in:
parent
46022cb162
commit
93aa469f16
|
@ -405,11 +405,11 @@ class LoggingConnection(_connection):
|
||||||
def initialize(self, logobj):
|
def initialize(self, logobj):
|
||||||
"""Initialize the connection to log to `!logobj`.
|
"""Initialize the connection to log to `!logobj`.
|
||||||
|
|
||||||
The `!logobj` parameter can be an open file object or a Logger
|
The `!logobj` parameter can be an open file object or a Logger/LoggerAdapter
|
||||||
instance from the standard logging module.
|
instance from the standard logging module.
|
||||||
"""
|
"""
|
||||||
self._logobj = logobj
|
self._logobj = logobj
|
||||||
if _logging and isinstance(logobj, _logging.Logger):
|
if _logging and isinstance(logobj, (_logging.Logger, _logging.LoggerAdapter)):
|
||||||
self.log = self._logtologger
|
self.log = self._logtologger
|
||||||
else:
|
else:
|
||||||
self.log = self._logtofile
|
self.log = self._logtofile
|
||||||
|
|
Loading…
Reference in New Issue
Block a user