Beispiel #1
0
 def __init__(self, action, fields=None, parent=None, timer=get_time, lib=None, _offset=None):
     self.act = int(action)
     self.fields = {} if fields is None else dict(fields)
     self.parent = parent
     self.global_emits = []
     self.__local_emits = []
     self._time_offset = _offset or monotonic()
     self.start_time = int(timer if isinstance(timer, (int, long))
                           else timer())
     self.lib = None if lib is None else str(lib)
Beispiel #2
0
 def log(self, event, errcode, info):
     """Emit a log event and call all emitter listening for this logger"""
     time = self.start_time + (monotonic() - self._time_offset)
     log = self
     lib = self.lib
     while log:
         actions = tuple(self.actions())
         fields = {}
         for fds in self.all_fields():
             fields.update(fds)
         for emitter in log.__local_emits:
             emitter(event, time, actions, int(errcode), fields, info, lib)
         for emitter in log.global_emits:
             emitter(event, time, actions, int(errcode), fields, info, lib)
         log = log.parent
 def log(self, event, errcode, info):
     """Emit a log event and call all emitter listening for this logger"""
     time = self.start_time + (monotonic() - self._time_offset)
     log = self
     lib = self.lib
     while log:
         actions = tuple(self.actions())
         fields = {}
         for fds in self.all_fields():
             fields.update(fds)
         for emitter in log.__local_emits:
             emitter(event, time, actions, int(errcode), fields, info, lib)
         for emitter in log.global_emits:
             emitter(event, time, actions, int(errcode), fields, info, lib)
         log = log.parent
 def __init__(self,
              action,
              fields=None,
              parent=None,
              timer=get_time,
              lib=None,
              _offset=None):
     self.act = int(action)
     self.fields = {} if fields is None else dict(fields)
     self.parent = parent
     self.global_emits = []
     self.__local_emits = []
     self._time_offset = _offset or monotonic()
     if timer is None:
         timer = get_time
     self.start_time = int(timer if isinstance(timer, (int,
                                                       long)) else timer())
     self.lib = None if not config.keep_lib_log and lib is None else str(
         lib)