adding inital packages for bootstrap cluster
[icn.git] / env / lib / logging.sh
old mode 100644 (file)
new mode 100755 (executable)
index e69de29..40a29f8
@@ -0,0 +1,10 @@
+#!/bin/bash
+
+# Log output automatically
+# referred from metal3 project
+LOGDIR="$(dirname $0)/logs"
+if [ ! -d "$LOGDIR" ]; then
+    mkdir -p "$LOGDIR"
+fi
+LOGFILE="$LOGDIR/$(basename $0 .sh)-$(date +%F-%H%M%S).log"
+exec 1> >( tee "${LOGFILE}" ) 2>&1