mirror of
https://github.com/ARM-software/workload-automation.git
synced 2025-01-31 18:21:14 +00:00
Merge pull request #526 from bjackman/log-error-fix
Fix logging error when exception raised
This commit is contained in:
commit
303679124c
@ -159,9 +159,9 @@ def log_error(e, logger, critical=False):
|
|||||||
|
|
||||||
:e: the error to log. should be an instance of ``Exception``
|
:e: the error to log. should be an instance of ``Exception``
|
||||||
:logger: logger to be used.
|
:logger: logger to be used.
|
||||||
:critical: if ``True``, this error will be logged at ``logging.CRITICAL``
|
:critical: if ``True``, this error will be logged at ``logging.CRITICAL``
|
||||||
level, otherwise it will be logged as ``logging.ERROR``.
|
level, otherwise it will be logged as ``logging.ERROR``.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
if critical:
|
if critical:
|
||||||
log_func = logger.critical
|
log_func = logger.critical
|
||||||
@ -171,7 +171,7 @@ def log_error(e, logger, critical=False):
|
|||||||
if isinstance(e, KeyboardInterrupt):
|
if isinstance(e, KeyboardInterrupt):
|
||||||
log_func('Got CTRL-C. Aborting.')
|
log_func('Got CTRL-C. Aborting.')
|
||||||
elif isinstance(e, WAError) or isinstance(e, DevlibError):
|
elif isinstance(e, WAError) or isinstance(e, DevlibError):
|
||||||
log_func(e)
|
log_func(str(e))
|
||||||
elif isinstance(e, subprocess.CalledProcessError):
|
elif isinstance(e, subprocess.CalledProcessError):
|
||||||
tb = get_traceback()
|
tb = get_traceback()
|
||||||
log_func(tb)
|
log_func(tb)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user