summaryrefslogtreecommitdiffstats
path: root/modules/log.bash
diff options
context:
space:
mode:
authorclsr <clsr@clsr.net>2017-04-23 22:02:55 +0200
committerclsr <clsr@clsr.net>2017-04-23 22:02:55 +0200
commit74c839cd6bb5582e30c4412dea34620be4c0c844 (patch)
tree499e60c7571273b6fed004d8d8e01c9e4ce44a8e /modules/log.bash
parentff2bc5d0931d4a460d4d74183b6f9dd9394c40a0 (diff)
downloadmbibot-74c839cd6bb5582e30c4412dea34620be4c0c844.tar.gz
mbibot-74c839cd6bb5582e30c4412dea34620be4c0c844.zip
Let bash find and assign file descriptors for IRC socket and logging
Diffstat (limited to 'modules/log.bash')
-rw-r--r--modules/log.bash10
1 files changed, 5 insertions, 5 deletions
diff --git a/modules/log.bash b/modules/log.bash
index e9fc665..cd4e038 100644
--- a/modules/log.bash
+++ b/modules/log.bash
@@ -16,12 +16,12 @@ fi
if [[ -n ${LOG_IRC:-} ]]; then
if [[ ${LOG_SHOW_IRC:-0} -ne 0 ]]; then
- exec 14> >(tee -a -- "$LOG_IRC")
+ exec {log_fd}> >(tee -a -- "$LOG_IRC")
else
- exec 14>>"$LOG_IRC"
+ exec {log_fd}>>"$LOG_IRC"
fi
elif [[ ${LOG_SHOW_IRC:-0} -ne 0 ]]; then
- exec 14>&1
+ exec {log_fd}>&1
fi
if [[ -n ${LOG_ERR:-} ]]; then
@@ -31,12 +31,12 @@ fi
# log received messages
on_readmsg() { # args: $1 - raw message, $2 - source, $3 - command, $4... - args
- printf "%s <<< %s\n" "$(log_timestamp)" "$1" >&14
+ printf "%s <<< %s\n" "$(log_timestamp)" "$1" >&$log_fd
}
# log sent messages
on_sendmsg() { # args: $1 - raw message, $2 - command, $3... - args
- printf "%s >>> %s\n" "$(log_timestamp)" "$1" >&14
+ printf "%s >>> %s\n" "$(log_timestamp)" "$1" >&$log_fd
}
log_timestamp() {