Logging¶
Logging module holds utilities that help with logging and analyzing the creative system’s behavior.
-
class
creamas.logging.
ObjectLogger
(obj, folder, add_name=False, init=True, log_level=10)[source]¶ Base logger for Creamas objects. Not a subclass of
logging.Logger
.Generates one file for each attribute to be logged.
Create new logger instance for obj in folder. If add_name is
True
, creates subfolder carryingobj.name
to folder. If init is true, sets logger’s level to log_level and adds basic StreamHandler to the logger.-
log_attr
(level, attr_name)[source]¶ Log attribute to file and pass the message to underlying logger.
-
property
folder
¶ Root logging folder for this logger.
-
property
obj
¶ Object this logger belongs to. Object has to have name attribute.
-
-
creamas.logging.
log_before
(attr, level=10)[source]¶ Decorator to log attribute’s value(s) before function call.
Implementation allows usage only for methods belonging to class. The class instance needs to have a
logger
that is derived fromObjectLogger
.
-
creamas.logging.
log_after
(attr, level=10)[source]¶ Decorator to log attribute’s value(s) after function call.
Implementation allows usage only for methods belonging to class. The class instance needs to have a
logger
that is derived fromObjectLogger
.