Exemple #1
0
 def _set_waiting_on_status(self, frame_before_caller=False):
     f = inspect.currentframe().f_back.f_back
     if frame_before_caller:
         f = getattr(f, 'f_back')
     c = pkinspect.Call(f)
     self._waiting_on = {
         k: c[k] for k in sorted(c.keys()) if k in ('lineno', 'name')
     }
     yield
     # Only clear _waiting_on in the successful case. In failure
     # leave it for debugging
     self._waiting_on = None
Exemple #2
0
    def emit(self, record):
        """Emit a log record via _printer

        Writes all `logging.INFO` and above like `pkdp`, that is,
        always. Below `logging.INFO` (i.e. DEBUG) is written like
        `pkdc` using the same matching algorithms by converting
        log records appropriately.
        """
        wc = record.levelno < logging.INFO
        _printer._process(
            lambda: pkinspect.Call(record),
            lambda: '{}:{}:{}'.format(record.levelname, record.name,
                                      self.format(record)),
            lambda: (record.process,
                     datetime.datetime.utcfromtimestamp(record.created)),
            with_control=wc,
        )
Exemple #3
0
 def prefix():
     return pkinspect.Call(
         inspect.currentframe().f_back.f_back.f_back.f_back)
Exemple #4
0
 def prefix():
     return pkinspect.Call(record)
Exemple #5
0
 def prefix():
     return pkinspect.Call(
         kwargs.get('pkdebug_frame')
         or inspect.currentframe().f_back.f_back.f_back.f_back, )