summaryrefslogtreecommitdiff
path: root/home/scripts/log.sh
diff options
context:
space:
mode:
Diffstat (limited to 'home/scripts/log.sh')
-rwxr-xr-xhome/scripts/log.sh32
1 files changed, 0 insertions, 32 deletions
diff --git a/home/scripts/log.sh b/home/scripts/log.sh
deleted file mode 100755
index 8895097..0000000
--- a/home/scripts/log.sh
+++ /dev/null
@@ -1,32 +0,0 @@
-#!/bin/sh
-
-# usage:
-# > source log.sh <CALLER>
-# > log INFO "hello"
-# > log "this is epic"
-# > log DEBUG "yo"
-
-_LOG_CALLER=$(basename "$1")
-
-log() {
- LEVEL=$1
- shift
-
- case "$LEVEL" in
- INFO|DEBUG|ERROR)
- ;;
- *)
- set -- "INFO" "$LEVEL" "$@"
- LEVEL="INFO"
- ;;
- esac
-
- TIMESTAMP=$(date '+%Y-%m-%d %H:%M:%S')
- MESSAGE="$*"
-
- if [ "$LEVEL" = "DEBUG" ] && [ -z "$DEBUG" ]; then
- return
- fi
-
- echo "[$TIMESTAMP] [$_LOG_CALLER] [$LEVEL] $MESSAGE"
-}