logger.py¶
This module defines amoco logging facilities.
The Log
class inherits from a standard logging.Logger
,
with minor additional features like a 'VERBOSE'
level introduced between
'INFO'
and 'DEBUG'
levels, and a progress method that can be useful for time consuming activities.
See below for details.
Most amoco modules start by creating their local logger
object used to
provide various feedback.
Users can thus focus on messages from selected amoco modules by adjusting their
level independently, or use the set_quiet()
, set_debug()
or
set_log_all(level)
functions to adjust all loggers at once.
Examples
Setting the mapper module to 'VERBOSE'
level:
In [1]: import amoco
In [2]: amoco.cas.mapper.logger.setlevel('VERBOSE')
Setting all modules loggers to 'ERROR'
level:
In [2]: amoco.logger.set_quiet()
Note:
All loggers can be configured to log both to stderr with selected level
and to a unique temporary file with 'DEBUG'
level. See configuration.
-
class
logger.
Log
(name, handler=<StreamHandler <stderr> (NOTSET)>)[source]¶ This class is intended to allow amoco activities to be logged simultaneously to the stderr output with an adjusted level and to a temporary file with full verbosity.
All instanciated Log objects are tracked by the Log class attribute
Log.loggers
which maps their names with associated instances.The recommended way to create a Log object is to add, near the begining of amoco modules:
from amoco.logger import Log logger = Log(__name__)