fix log_message, log_updates do not interpret \n\t etc

This commit is contained in:
Kay Marquardt (Gnadelwartz) 2020-12-30 10:03:23 +01:00
parent 91419a2691
commit 29f2ce8418

View File

@ -26,7 +26,7 @@
# 8 - curl/wget missing # 8 - curl/wget missing
# 10 - not bash! # 10 - not bash!
# #
#### $$VERSION$$ v1.21-dev-36-gc6001c2 #### $$VERSION$$ v1.21-dev-37-g91419a2
################################################################## ##################################################################
# shellcheck disable=SC2140,SC2031,SC2120,SC1091,SC1117,SC2059 # shellcheck disable=SC2140,SC2031,SC2120,SC1091,SC1117,SC2059
@ -95,11 +95,12 @@ check_token(){
[[ "${1}" =~ ^[0-9]{8,10}:[a-zA-Z0-9_-]{35}$ ]] && return 0 [[ "${1}" =~ ^[0-9]{8,10}:[a-zA-Z0-9_-]{35}$ ]] && return 0
return 1 return 1
} }
# log $1 to ERRORLOG with date # log $1 with date, interpret \n \t ...
log_error(){ printf "%s: %b\n" "$(date)" "$*" >>"${ERRORLOG}"; } log_error(){ printf "%s: %b\n" "$(date)" "$*" >>"${ERRORLOG}"; }
log_debug(){ printf "%s: %b\n" "$(date)" "$*" >>"${DEBUGLOG}"; } log_debug(){ printf "%s: %b\n" "$(date)" "$*" >>"${DEBUGLOG}"; }
log_message(){ printf "\n%s: %s\n" "$(date)" "$*" >>"${MESSAGELOG}"; } # log $1 with date
log_update(){ printf "%s: %b\n" "$(date)" "$*" >>"${UPDATELOG}"; } log_update(){ printf "%s: %s\n" "$(date)" "$*" >>"${UPDATELOG}"; }
log_message(){ printf "\n%s: %s\n" "$(date)" "$*" >>"${MESSAGELOG/\\n/$'\n'}"; }
# additional tests if we run in debug mode # additional tests if we run in debug mode
export BASHBOTDEBUG export BASHBOTDEBUG