mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-12-18 04:18:10 +00:00
Implemented log.exception, improved logging
Removed unused code
This commit is contained in:
parent
b0d9a4b884
commit
3a7e343a43
@ -2,7 +2,7 @@ import sys
|
||||
import utime
|
||||
from . import utils
|
||||
|
||||
import log
|
||||
from . import log
|
||||
|
||||
_new_layout = None
|
||||
_current_layout = None
|
||||
|
@ -1,3 +1,4 @@
|
||||
import _io
|
||||
import sys
|
||||
import utime
|
||||
|
||||
@ -39,5 +40,10 @@ def warning(name, msg, *args):
|
||||
def error(name, msg, *args):
|
||||
_log(name, ERROR, msg, *args)
|
||||
|
||||
def exception(name, exc):
|
||||
out = _io.StringIO()
|
||||
sys.print_exception(exc, out)
|
||||
_log(name, ERROR, out.getvalue())
|
||||
|
||||
def critical(name, msg, *args):
|
||||
_log(name, CRITICAL, msg, *args)
|
||||
|
@ -1,5 +1,4 @@
|
||||
import utime
|
||||
import sys
|
||||
|
||||
from uheapq import heappop, heappush
|
||||
from .utils import type_gen
|
||||
@ -12,8 +11,6 @@ EVT_TMOVE = const(-2)
|
||||
EVT_TEND = const(-3)
|
||||
EVT_MSG = const(-4)
|
||||
|
||||
DO_NOTHING = const(-5)
|
||||
|
||||
evt_handlers = { EVT_TSTART: None,
|
||||
EVT_TMOVE: None,
|
||||
EVT_TEND: None,
|
||||
@ -114,18 +111,13 @@ def run_forever(start_gens):
|
||||
# gen ended, forget it and go on
|
||||
continue
|
||||
except Exception as e:
|
||||
# FIXME
|
||||
log.error(__name__, str(e))
|
||||
sys.print_exception(e)
|
||||
# log.exception(__name__, e)
|
||||
log.exception(__name__, e)
|
||||
continue
|
||||
|
||||
if isinstance(ret, int):
|
||||
if ret >= 0:
|
||||
# sleep until ret, call us later
|
||||
__call_at(ret, gen)
|
||||
elif ret == DO_NOTHING:
|
||||
print("Removing gen from time queue")
|
||||
else:
|
||||
# wait for event
|
||||
raise NotImplementedError()
|
||||
|
Loading…
Reference in New Issue
Block a user