add timestamps to logged messages

Having basic timestamps for logged messages can help narrow down
issues in builds.  We already do this for Python code, so add it
to our shell scripts too.  Some of the steps here can take quite
a long time to run.

BUG=None
TEST=sdk bootstrap & CQ passes

Change-Id: I6dd1e352f898d8213ec92574097bbe4c040ef613
Reviewed-on: https://chromium-review.googlesource.com/1789856
Tested-by: Mike Frysinger <vapier@chromium.org>
Commit-Ready: Mike Frysinger <vapier@chromium.org>
Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org>
Reviewed-by: Alex Klein <saklein@chromium.org>
diff --git a/common.sh b/common.sh
index 246297d..5d0859d 100644
--- a/common.sh
+++ b/common.sh
@@ -87,6 +87,7 @@
 _message() {
   local prefix=$1
   shift
+  printf '%s: ' "$(date +%H:%M:%S)" >&2
   if [[ $# -eq 0 ]]; then
     echo -e "${prefix}${CROS_LOG_PREFIX:-""}:${V_VIDOFF}" >&2
     return
diff --git a/sdk_lib/make_chroot.sh b/sdk_lib/make_chroot.sh
index 49faeb1..7531d72 100755
--- a/sdk_lib/make_chroot.sh
+++ b/sdk_lib/make_chroot.sh
@@ -93,7 +93,7 @@
 
 # Invoke enter_chroot.  This can only be used after sudo has been installed.
 enter_chroot() {
-  echo "[enter_chroot] $*"
+  echo "$(date +%H:%M:%S) [enter_chroot] $*"
   "$ENTER_CHROOT" --cache_dir "${FLAGS_cache_dir}" --chroot "$FLAGS_chroot" \
     -- "${ENTER_CHROOT_ARGS[@]}" "$@"
 }
@@ -102,7 +102,7 @@
 # This should be used prior to sudo being merged.
 early_env=()
 early_enter_chroot() {
-  echo "[early_enter_chroot] $*"
+  echo "$(date +%H:%M:%S) [early_enter_chroot] $*"
   "$ENTER_CHROOT" --chroot "$FLAGS_chroot" --early_make_chroot \
     --cache_dir "${FLAGS_cache_dir}" \
     -- "${ENTER_CHROOT_ARGS[@]}" "${early_env[@]}" "$@"