Refactor error logging

It is hard to grep errors in current log. so in this patch,
I'm updating die function which also writes log for
screen_log_dir/error.log.
In future, we may categolize negative fault by using
this error.log.

Change-Id: I70a8cfe67ed408284f5c88c762c6bb8acb8ecdb2
diff --git a/lib/quantum b/lib/quantum
index 0fef1ae..9068f62 100644
--- a/lib/quantum
+++ b/lib/quantum
@@ -351,8 +351,7 @@
     screen_it q-svc "cd $QUANTUM_DIR && python $QUANTUM_DIR/bin/quantum-server --config-file $QUANTUM_CONF --config-file /$Q_PLUGIN_CONF_FILE"
     echo "Waiting for Quantum to start..."
     if ! timeout $SERVICE_TIMEOUT sh -c "while ! http_proxy= wget -q -O- http://$Q_HOST:$Q_PORT; do sleep 1; done"; then
-      echo "Quantum did not start"
-      exit 1
+      die $LINENO "Quantum did not start"
     fi
 }
 
@@ -396,8 +395,7 @@
     quantum_plugin_configure_common
 
     if [[ $Q_PLUGIN_CONF_PATH == '' || $Q_PLUGIN_CONF_FILENAME == '' || $Q_PLUGIN_CLASS == '' ]]; then
-        echo "Quantum plugin not set.. exiting"
-        exit 1
+        die $LINENO "Quantum plugin not set.. exiting"
     fi
 
     # If needed, move config file from ``$QUANTUM_DIR/etc/quantum`` to ``QUANTUM_CONF_DIR``
@@ -511,8 +509,7 @@
     if is_service_enabled $DATABASE_BACKENDS; then
         recreate_database $Q_DB_NAME utf8
     else
-        echo "A database must be enabled in order to use the $Q_PLUGIN Quantum plugin."
-        exit 1
+        die $LINENO "A database must be enabled in order to use the $Q_PLUGIN Quantum plugin."
     fi
 
     # Update either configuration file with plugin
@@ -661,11 +658,10 @@
     fi
     if ! timeout $timeout_sec sh -c "$check_command"; then
         if [[ "$expected" = "True" ]]; then
-            echo "[Fail] Couldn't ping server"
+            die $LINENO "[Fail] Couldn't ping server"
         else
-            echo "[Fail] Could ping server"
+            die $LINENO "[Fail] Could ping server"
         fi
-        exit 1
     fi
 }
 
@@ -679,8 +675,7 @@
     local probe_cmd = ""
     probe_cmd=`_get_probe_cmd_prefix $from_net`
     if ! timeout $timeout_sec sh -c "while ! $probe_cmd ssh -o StrictHostKeyChecking=no -i $key_file ${user}@$ip echo success ; do sleep 1; done"; then
-        echo "server didn't become ssh-able!"
-        exit 1
+        die $LINENO "server didn't become ssh-able!"
     fi
 }