aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkaotisk <kaotisk@arching-kaos.org>2024-02-29 19:44:00 +0200
committerkaotisk <kaotisk@arching-kaos.org>2024-02-29 19:44:00 +0200
commitf53340fa52437b7a4dbe06834f0cdf1233678c72 (patch)
tree4829aa0f6dce8b0053ca7ce9d8802d106f910297
parent2e45e945cb7baa3131430c9c069f9ba9d4ee77b9 (diff)
downloadarching-kaos-tools-f53340fa52437b7a4dbe06834f0cdf1233678c72.tar.gz
arching-kaos-tools-f53340fa52437b7a4dbe06834f0cdf1233678c72.tar.bz2
arching-kaos-tools-f53340fa52437b7a4dbe06834f0cdf1233678c72.zip
Added debug output
-rw-r--r--README16
-rwxr-xr-xbin/ak-logthis16
2 files changed, 32 insertions, 0 deletions
diff --git a/README b/README
index 6d6173b..4ee7d55 100644
--- a/README
+++ b/README
@@ -312,3 +312,19 @@ ak-get-only-ipfs-key-values-from-our-zchain # Retuns CIDs of "ipfs" DATA
Deprecated
----------
ak-json2bash
+
+
+Debugging
+---------
+
+Setting `AK_DEBUG` shell variable to `"yes"` will make all log messages to
+appear on your stderr (file descriptor 2). After setting this variable, run the
+tools you want.
+
+Example:
+``` console
+
+AK_DEBUG="yes"; ak-enter -l 1
+
+```
+
diff --git a/bin/ak-logthis b/bin/ak-logthis
index 024f9d2..295f60d 100755
--- a/bin/ak-logthis
+++ b/bin/ak-logthis
@@ -7,17 +7,33 @@ then
if [ ! -z "$3" ]
then
echo "$TS" "$1" "$2" "$3" >> $AK_LOGSFILE
+ if [ "$AK_DEBUG" == "yes" ]
+ then
+ echo "$TS" "$1" "$2" "$3" >&2
+ fi
exit 0
else
echo "$TS" "$1" "[ERROR]" "No message" >> $AK_LOGSFILE
+ if [ "$AK_DEBUG" == "yes" ]
+ then
+ echo "$TS" "$1" "[ERROR]" "No message" >&2
+ fi
exit 1
fi
else
echo "$TS" "$1" "[ERROR]" "No type and message" >> $AK_LOGSFILE
+ if [ "$AK_DEBUG" == "yes" ]
+ then
+ echo "$TS" "$1" "[ERROR]" "No type and message" >&2
+ fi
exit 1
fi
else
echo "$TS" "<$(basename $0)>" "[ERROR]" "No arguments given" >> $AK_LOGSFILE
+ if [ "$AK_DEBUG" == "yes" ]
+ then
+ echo "$TS" "<$(basename $0)>" "[ERROR]" "No arguments given" >&2
+ fi
exit 1
fi