Exemplo n.º 1
0
 def formatted_records(self):
     """Captures the formatted log records as unicode strings."""
     if len(self._formatted_records) != self.records or \
        any(r1 != r2 for r1, (r2, f) in
            izip(self.records, self._formatted_records)):
         self._formatted_records = map(self.format, self.records)
         self._formatted_record_cache = list(self.records)
     return self._formatted_records
Exemplo n.º 2
0
 def __new__(cls, name, bases, d):
     # aha, that thing has a custom close method.  We will need a magic
     # __del__ for it to be called on cleanup.
     if bases != (ContextObject,) and 'close' in d and '__del__' not in d \
        and not any(hasattr(x, '__del__') for x in bases):
         def _magic_del(self):
             try:
                 self.close()
             except Exception:
                 # del is also invoked when init fails, so we better just
                 # ignore any exception that might be raised here
                 pass
         d['__del__'] = _magic_del
     return type.__new__(cls, name, bases, d)
Exemplo n.º 3
0
 def has_debugs(self):
     """`True` if any :data:`DEBUG` records were found."""
     return any(r.level == DEBUG for r in self.records)
Exemplo n.º 4
0
 def has_infos(self):
     """`True` if any :data:`INFO` records were found."""
     return any(r.level == INFO for r in self.records)
Exemplo n.º 5
0
 def has_notices(self):
     """`True` if any :data:`NOTICE` records were found."""
     return any(r.level == NOTICE for r in self.records)
Exemplo n.º 6
0
 def has_warnings(self):
     """`True` if any :data:`WARNING` records were found."""
     return any(r.level == WARNING for r in self.records)
Exemplo n.º 7
0
 def has_errors(self):
     """`True` if any :data:`ERROR` records were found."""
     return any(r.level == ERROR for r in self.records)
Exemplo n.º 8
0
 def has_criticals(self):
     """`True` if any :data:`CRITICAL` records were found."""
     return any(r.level == CRITICAL for r in self.records)