]> git.corax.cc Git - toolbox/commitdiff
include/log: Remove log_write() from public API
authorMatthias Kruk <m@m10k.eu>
Thu, 24 Jun 2021 23:46:58 +0000 (08:46 +0900)
committerMatthias Kruk <m@m10k.eu>
Thu, 24 Jun 2021 23:46:58 +0000 (08:46 +0900)
The log_write() function is not intended to be used directly, so it
should not be part of the public API of the log module.
This commit makes the log_write() function private by renaming it to
_log_write() and updating all references to it.

include/log.sh

index f547299c55f2809dd0af15fb3028c6b01a12d973..51712066db90c61452e8886718c4582f66e21cd9 100644 (file)
@@ -80,7 +80,7 @@ log_decrease_verbosity() {
        return 0
 }
 
-log_write() {
+_log_write() {
        local level="$1"
        local prefix="$2"
 
@@ -107,7 +107,7 @@ log_write() {
                done
        else
                while read -r line; do
-                       log_write "$level" "$prefix" "$line"
+                       _log_write "$level" "$prefix" "$line"
                done
        fi
 
@@ -154,23 +154,23 @@ log_debug() {
 
        dbgtag="${BASH_SOURCE[1]}:${BASH_LINENO[1]} ${FUNCNAME[1]}:"
 
-       log_write "$__log_debug" "[DBG] $dbgtag" "${lines[@]}"
+       _log_write "$__log_debug" "[DBG] $dbgtag" "${lines[@]}"
 }
 
 log_info() {
        local lines=("$@")
 
-       log_write "$__log_info" "[INF]" "${lines[@]}"
+       _log_write "$__log_info" "[INF]" "${lines[@]}"
 }
 
 log_warn() {
        local lines=("$@")
 
-       log_write "$__log_warning" "[WRN]" "${lines[@]}"
+       _log_write "$__log_warning" "[WRN]" "${lines[@]}"
 }
 
 log_error() {
        local lines=("$@")
 
-       log_write "$__log_error" "[ERR]" "${lines[@]}"
+       _log_write "$__log_error" "[ERR]" "${lines[@]}"
 }