Move appropriate log messages to the trace level

This commit is contained in:
Nick Chambers 2021-11-06 19:44:59 -05:00
parent 65eee69f8e
commit 030b67a183
1 changed files with 16 additions and 14 deletions

30
rowbot
View File

@ -335,6 +335,7 @@ on_sys_before_999_bootup() {
for setting in "${!config[@]}"; do
setting_name=${setting//-/_}
export "CONFIG_${setting_name^^}=${config[$setting]}"
log_trace "storing config key %s with value %s" "CONFIG_${setting_name^^}" "${config[$setting]}"
done
}
@ -346,6 +347,7 @@ on_sys_after_001_bootup() {
setting_name=${setting#CONFIG_} setting_name=${setting_name//_/-}
config[${setting_name,,}]=${!setting}
unset "$setting"
log_trace "getting config key %s with value %s" "CONFIG_${setting_name^^}" "${config[$setting]}"
done < <(compgen -e CONFIG_)
}
@ -361,7 +363,7 @@ net_recv() {
declare -n sock_line=$1
IFS= read -ru "$in_sock" "$1"
sock_line=${sock_line%$'\r'}
log_debug "received line: %s" "$sock_line"
log_trace "received line: %s" "$sock_line"
}
net_send() {
@ -370,7 +372,7 @@ net_send() {
# shellcheck disable=SC2059
printf -v fmt "$1" "${@:2}"
printf '%s\r\n' "$fmt" >&"$out_sock"
log_debug "sending line: %s" "$fmt"
log_trace "sending line: %s" "$fmt"
}
on_sys_init_002_net() {
@ -525,7 +527,7 @@ on_msg_005_welcome() {
# use it.
# shellcheck disable=SC2034
isupport[$key]=$value
log_debug "isupport: %s = %s" "$key" "$value"
log_trace "isupport: %s = %s" "$key" "$value"
done
}
@ -611,11 +613,11 @@ irc_on_PART() {
irc_on_PING() {
irc_pong "${msg_args[1]}"
log_debug "received ping: %s" "${msg_args[0]}"
log_trace "received ping: %s" "${msg_args[0]}"
}
irc_on_PONG() {
log_debug "received pong: %s" "${msg_args[1]}"
log_trace "received pong: %s" "${msg_args[1]}"
}
irc_on_PRIVMSG() {
@ -649,7 +651,7 @@ irc_on_004() {
}
irc_on_005() {
log_debug "received inotify specification: ${msg_args[*]:1}"
log_debug "received isupport specification: ${msg_args[*]:1}"
}
irc_on_250() {
@ -771,7 +773,7 @@ irc_notice() {
if [[ -v config[host] ]]; then
(( msg_len = 494 - (${#config[nick]} + ${#config[ident]} + ${#config[host]} + ${#1}) ))
log_debug "max message length is %d" "$msg_len"
log_trace "max message length for NOTICE is %d" "$msg_len"
while (( ${#msg} > msg_len )); do
net_send "NOTICE %s :"$'\xe2\x80\x8b'"%s" "$1" "${msg:0:$msg_len}"
@ -807,7 +809,7 @@ irc_privmsg() {
if [[ -v config[host] ]]; then
(( msg_len = 493 - (${#config[nick]} + ${#config[ident]} + ${#config[host]} + ${#1}) ))
log_debug "max message length is %d" "$msg_len"
log_trace "max message length for PRIVMSG is %d" "$msg_len"
while (( ${#msg} > msg_len )); do
net_send "PRIVMSG %s :"$'\xe2\x80\x8b'"%s" "$1" "${msg:0:$msg_len}"
@ -990,7 +992,7 @@ on_register_alternick() {
on_early_msg_433_alternick() {
if [[ ${config[registered]} = yes ]]; then
log_debug "somebody is already using ${config[nick/]}"
log_debug "somebody is already using ${config[nick]}"
return 1
fi
}
@ -1164,7 +1166,7 @@ while net_recv line; do
if [[ ${line:0:1} = :* ]]; then
prefix=${line%% *} prefix=${prefix#:} line=${line#:"$prefix"} line=${line# }
log_debug "parsing message prefix %s" "$prefix"
log_trace "parsing message prefix %s" "$prefix"
msg[host]=${prefix#*@} prefix=${prefix%"${msg[host]}"} prefix=${prefix%@}
msg[from]=${msg[host]}
@ -1194,7 +1196,7 @@ while net_recv line; do
msg[cmd]=${line%% *} line=${line#"${msg[cmd]}"} line=${line# }
msg[cmd]=${msg[cmd]^^}
log_debug "parsing message command %s" "${msg[cmd]}"
log_trace "parsing message command %s" "${msg[cmd]}"
# parse the remaining values into white-space separated arguments
@ -1204,10 +1206,10 @@ while net_recv line; do
if [[ ${line:0:1} = : ]]; then
msg_args+=( "${line:1}" ) msg[words]=yes line=
read -ra msg_words <<< "${msg_args[-1]}"
log_debug "parsed final argument %s" "${msg_args[-1]}"
log_trace "parsed final argument %s" "${msg_args[-1]}"
else
arg=${line%% *} msg_args+=( "$arg" ) line=${line#"$arg"} line=${line# }
log_debug "parsed argument %s" "$arg"
log_trace "parsed argument %s" "$arg"
fi
done
@ -1227,7 +1229,7 @@ while net_recv line; do
esac
fi
log_debug "bot score is %d" "${msg[score]}"
log_trace "bot score is %d" "${msg[score]}"
if has irc_on_"${msg[cmd]}"; then
if run_callbacks "on_early_msg_${msg[cmd]}_"; then