aboutsummaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorkaotisk <kaotisk@arching-kaos.org>2024-01-12 06:42:38 +0200
committerkaotisk <kaotisk@arching-kaos.org>2024-01-12 06:42:38 +0200
commit7d137436bf7583ac30628d239fec55bb2f8a4ca5 (patch)
tree8221debb475c86f4993baf3dee42ac9247f93a59 /bin
parent72bf886edc73d1a5ddd8cbcdd083d42ce305ce22 (diff)
downloadarching-kaos-tools-7d137436bf7583ac30628d239fec55bb2f8a4ca5.tar.gz
arching-kaos-tools-7d137436bf7583ac30628d239fec55bb2f8a4ca5.tar.bz2
arching-kaos-tools-7d137436bf7583ac30628d239fec55bb2f8a4ca5.zip
Proper log script
Diffstat (limited to 'bin')
-rwxr-xr-xbin/ak-logthis22
1 files changed, 21 insertions, 1 deletions
diff --git a/bin/ak-logthis b/bin/ak-logthis
index e1e55d0..024f9d2 100755
--- a/bin/ak-logthis
+++ b/bin/ak-logthis
@@ -1,3 +1,23 @@
#!/bin/bash
-echo "$(date -u +%s)" "$1" "$2" "$3" >> $AK_LOGSFILE
+TS="$(date -u +%s)"
+if [ ! -z "$1" ]
+then
+ if [ ! -z "$2" ]
+ then
+ if [ ! -z "$3" ]
+ then
+ echo "$TS" "$1" "$2" "$3" >> $AK_LOGSFILE
+ exit 0
+ else
+ echo "$TS" "$1" "[ERROR]" "No message" >> $AK_LOGSFILE
+ exit 1
+ fi
+ else
+ echo "$TS" "$1" "[ERROR]" "No type and message" >> $AK_LOGSFILE
+ exit 1
+ fi
+else
+ echo "$TS" "<$(basename $0)>" "[ERROR]" "No arguments given" >> $AK_LOGSFILE
+ exit 1
+fi