1
0
mirror of https://github.com/ARM-software/workload-automation.git synced 2025-09-02 11:22:41 +01:00

fw: fix error logging

- Keep track of logged exceptions inside log_error itself.
- signal: log the exception, if there is one  in the finally clause of
  the  signal wrapper; this will ensure that the error will be logged
  closer to the command that originated.
- entrypoint: use log.log_error for top-level error logging, rather than
  the  entrypoint logger directly; this will ensure that errors are not
  repeated unnecessarily.
- Log CTRL-C message at zeroth indent level to make it easier to see in
  the  non-verbose output where it occurred.
This commit is contained in:
Sergei Trofimov
2018-02-28 15:18:58 +00:00
committed by Marc Bonnici
parent 6fe31d6cad
commit 04ab336afc
4 changed files with 24 additions and 15 deletions

View File

@@ -19,6 +19,7 @@ This module wraps louie signalling mechanism. It relies on modified version of l
that has prioritization added to handler invocation.
"""
import sys
import logging
from contextlib import contextmanager
@@ -298,7 +299,7 @@ def send(signal, sender=dispatcher.Anonymous, *args, **kwargs):
return dispatcher.send(signal, sender, *args, **kwargs)
# This will normally be set to log_error() by init_logging(); see wa.framework/log.py.
# This will normally be set to log_error() by init_logging(); see wa.utils.log
# Done this way to prevent a circular import dependency.
log_error_func = logger.error
@@ -337,6 +338,9 @@ def wrap(signal_name, sender=dispatcher.Anonymous,*args, **kwargs):
yield
send_func(success_signal, sender, *args, **kwargs)
finally:
exc_type, exc, tb = sys.exc_info()
if exc:
log_error_func(exc)
send_func(after_signal, sender, *args, **kwargs)