style(unitproc/):Shorten names of template prefix (bktemp -> bkt)
[BK-2020-03.git] / unitproc / bkt-vbm
diff --git a/unitproc/bkt-vbm b/unitproc/bkt-vbm
new file mode 100644 (file)
index 0000000..878a022
--- /dev/null
@@ -0,0 +1,29 @@
+#!/bin/bash
+# Desc: Display message if opVerbose true
+
+vbm() {
+    # Description: Prints verbose message ("vbm") to stderr if opVerbose is set to "true".
+    # Usage: vbm "DEBUG :verbose message here"
+    # Version 0.2.0
+    # Input: arg1: string
+    #        vars: opVerbose
+    # Output: stderr
+    # Depends: bash 5.0.3, echo 8.30, date 8.30
+
+    if [ "$opVerbose" = "true" ]; then
+       functionTime="$(date --iso-8601=ns)"; # Save current time in nano seconds.
+       echo "[$functionTime]:$0:""$*" 1>&2;  # Display argument text.
+    fi
+
+    # End function
+    return 0; # Function finished.
+} # Displays message if opVerbose true
+
+#==BEGIN sample code==
+vbm "STATUS:This is a status message.";
+opVerbose="true";
+vbm "STATUS:This is another status message.";
+#==END sample code==
+
+# Author: Steven Baltakatei Sandoval
+# License: GPLv3+