diff options
author | Cem Keylan <cem@ckyln.com> | 2020-05-23 02:18:13 +0300 |
---|---|---|
committer | Cem Keylan <cem@ckyln.com> | 2020-05-23 02:18:13 +0300 |
commit | e2c7f071b338372b75b47e5a8f44a4b513bf3154 (patch) | |
tree | 0a6f0b97227ae6c7c597fb5613a14387de1042a4 | |
parent | 3b3e6c6d519f8f5c262fab445449adfc79a6d694 (diff) | |
download | init-e2c7f071b338372b75b47e5a8f44a4b513bf3154.tar.gz |
rc.lib: define logger at the beginning (if it exists)
-rw-r--r-- | rc.lib | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -3,6 +3,11 @@ export PATH=$PATH:/usr/local/bin:/usr/bin +# logger is provided by 3 packages on the core repository (sbase, +# busybox, util-linux). However, it is optional. Since logger +# outputs to stderr, we cannot silence stderr to not display error +# messages in the rare case where it isn't available on the system. +logger=$(command -v logger) || logger=: log() { # A function to log all output to syslog (if it is available) @@ -22,7 +27,7 @@ log() { # standard input for the log. This means you can pipe the output # of a command to this function. Those will be logged as well. [ "$1" ] && printf 'init: %s\n' "$@" >/dev/kmsg 2>/dev/null - logger -t init "${@:--s}" + "$logger" -t init "${@:--s}" } |