Example #1
0
 def _log(self, level, event, nodetype=NodeType.PROGRAM, **kwargs):
     """
     Log messages for the program
     :param level:
     :param status:
     :param kwargs:
     :return:
     """
     log_node(level, self._name, event=event, nodetype=nodetype,
              **kwargs)
Example #2
0
 def __set__(self, inst, value):
     inst.__dict__.setdefault(self.name, self.default)
     if value != inst.__dict__[self.name]:
         inst.__dict__[self.name] = value
         log_args = {Keyword.TASK_UID: inst.name}
         log_level = Level.INFO
         # TODO - research better way to figure out who the parent is
         # At this point we determine the name of the template which is
         # one level below the root_work.  This will be revisited with
         # nested templates
         if inst.parent:
             if inst.parent.parent and inst.parent.parent.parent and inst.parent.parent.parent.parent:
                 log_args[Keyword.TMPL_UID] = inst.parent.parent.parent.name.replace(" ", "+")
             elif inst.parent.parent and inst.parent.parent.parent:
                 log_args[Keyword.TMPL_UID] = inst.parent.parent.name.replace(" ", "+")
             else:
                 log_args[Keyword.TMPL_UID] = inst.parent.name.replace(" ", "+")
         if self.handler:
             log_level = self.handler(inst, log_args, value)
         else:
             log_args[Keyword.EVENT] = self.name
         log_node(log_level, inst.name, nodetype=inst.get_type_name(), **log_args)