Added some methods to LoggerAdapter, and updated documentation.

This commit is contained in:
Vinay Sajip 2010-09-21 11:25:39 +00:00
parent ceff566886
commit c84f016988
5 changed files with 32 additions and 9 deletions

View file

@ -2599,8 +2599,8 @@ should, then :meth:`flush` is expected to do the needful.
.. method:: flush()
For a :class:`MemoryHandler`, flushing means just sending the buffered
records to the target, if there is one. Override if you want different
behavior.
records to the target, if there is one. The buffer is also cleared when
this happens. Override if you want different behavior.
.. method:: setTarget(target)
@ -2972,15 +2972,18 @@ __ context-info_
'extra'. The return value is a (*msg*, *kwargs*) tuple which has the
(possibly modified) versions of the arguments passed in.
In addition to the above, :class:`LoggerAdapter` supports all the logging
In addition to the above, :class:`LoggerAdapter` supports the following
methods of :class:`Logger`, i.e. :meth:`debug`, :meth:`info`, :meth:`warning`,
:meth:`error`, :meth:`exception`, :meth:`critical` and :meth:`log`. These
methods have the same signatures as their counterparts in :class:`Logger`, so
you can use the two types of instances interchangeably.
:meth:`error`, :meth:`exception`, :meth:`critical`, :meth:`log`,
:meth:`isEnabledFor`, :meth:`getEffectiveLevel`, :meth:`setLevel`,
:meth:`hasHandlers`. These methods have the same signatures as their
counterparts in :class:`Logger`, so you can use the two types of instances
interchangeably.
.. versionchanged:: 3.2
The :meth:`isEnabledFor` method was added to :class:`LoggerAdapter`. This
method delegates to the underlying logger.
The :meth:`isEnabledFor`, :meth:`getEffectiveLevel`, :meth:`setLevel` and
:meth:`hasHandlers` methods were added to :class:`LoggerAdapter`. These
methods delegate to the underlying logger.
Thread Safety