Beispiel #1
0
 def wrapped(*args, **kwargs):
     SL.addFilter(f)
     res = None
     try:
         res = fn(*args, **kwargs)
     except Exception:
         if dump_on_exception:
             print(colors.red("Got exception"))
             for r in f.records:
                 msg = "[%s]" % r.levelname
                 msg += " : %s" % r.msg
                 print(msg)
             print(colors.red("end of logs"))
         raise
     finally:
         SL.removeFilter(f)
     return res
Beispiel #2
0
 def wrapper(*args, **kwargs):
     res = None
     try:
         res = fn(*args, **kwargs)
     except Exception:
         ename, evalue, etb = sys.exc_info()
         print("got an error")
         SL.error(ename)
         SL.error(evalue)
         SL.error("\n".join(traceback.format_tb(etb)))
     return res