findmissing: Add timestamp to logging information
A complete robot run now takes more than three hours. Add timestamp
information to logging data to help tracking down the reason.
To fix a new upload error, use "from" keyword when re-raising an
exception.
BUG=None
TEST=Run robot and observe logging data
Change-Id: Idaa34c73ec1d642c0c5943269175ac7ffe80d612
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/dev-util/+/2618622
Reviewed-by: Curtis Malainey <cujomalainey@chromium.org>
Commit-Queue: Curtis Malainey <cujomalainey@chromium.org>
Tested-by: Guenter Roeck <groeck@chromium.org>
Auto-Submit: Guenter Roeck <groeck@chromium.org>
diff --git a/contrib/findmissing/util.py b/contrib/findmissing/util.py
index ab21496..27d4503 100755
--- a/contrib/findmissing/util.py
+++ b/contrib/findmissing/util.py
@@ -42,8 +42,8 @@
try:
subprocess.run(process_grep, check=True, stdout=subprocess.DEVNULL,
encoding='utf-8', errors='ignore')
- except subprocess.CalledProcessError:
- raise ProcessLookupError('Service %s is not running.' % keyword)
+ except subprocess.CalledProcessError as e:
+ raise ProcessLookupError('Service %s is not running.' % keyword) from e
def check_cloud_sql_proxy_running():
@@ -76,7 +76,8 @@
else:
level = logging.WARNING
- logging.basicConfig(format='%(levelname)s: %(message)s', level=level)
+ logging.basicConfig(format='%(asctime)s %(levelname)s: %(message)s', level=level,
+ datefmt='%Y-%m-%d %H:%M:%S')
f(*args)
return wrapped_preliminary_check