mirror of
https://github.com/psycopg/psycopg2.git
synced 2024-11-25 02:13:44 +03:00
Merge branch 'logging-adapter'
This commit is contained in:
commit
34c54f3fc3
2
NEWS
2
NEWS
|
@ -6,6 +6,8 @@ What's new in psycopg 2.8.5
|
||||||
|
|
||||||
- Fixed use of `!connection_factory` and `!cursor_factory` together
|
- Fixed use of `!connection_factory` and `!cursor_factory` together
|
||||||
(:ticket:`#1019`).
|
(:ticket:`#1019`).
|
||||||
|
- Added support for `~logging.LoggerAdapter` in
|
||||||
|
`~psycopg2.extras.LoggingConnection` (:ticket:`#1026`).
|
||||||
|
|
||||||
|
|
||||||
What's new in psycopg 2.8.4
|
What's new in psycopg 2.8.4
|
||||||
|
|
|
@ -406,11 +406,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