aboutsummaryrefslogtreecommitdiff
path: root/logger.sh
diff options
context:
space:
mode:
authorLinnea Gräf <nea@nea.moe>2024-05-10 20:01:49 +0200
committerLinnea Gräf <nea@nea.moe>2024-05-10 20:01:49 +0200
commit65cbc9069e15f7f77a0497395a7796906b8ade9a (patch)
tree5a36377e458fdf589365c2f1f8d516ae0c35fa37 /logger.sh
downloadatrocity-65cbc9069e15f7f77a0497395a7796906b8ade9a.tar.gz
atrocity-65cbc9069e15f7f77a0497395a7796906b8ade9a.tar.bz2
atrocity-65cbc9069e15f7f77a0497395a7796906b8ade9a.zip
Initial commit
Diffstat (limited to 'logger.sh')
-rw-r--r--logger.sh10
1 files changed, 10 insertions, 0 deletions
diff --git a/logger.sh b/logger.sh
new file mode 100644
index 0000000..600f0ba
--- /dev/null
+++ b/logger.sh
@@ -0,0 +1,10 @@
+_atrocity_log_output="${ATROCITY_LOG:-$(tty)}"
+if [ "$_atrocity_log_output" = "not a tty" ]; then
+ exec {_atrocity_log_descriptor}>&1
+else
+ exec {_atrocity_log_descriptor}>"$_atrocity_log_output"
+fi
+
+atrocity_debug() {
+ printf 'DBG : %s\n' "${*}" >&"$_atrocity_log_descriptor"
+}