diff options
-rw-r--r-- | sysconfig/network-scripts/network-functions | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/sysconfig/network-scripts/network-functions b/sysconfig/network-scripts/network-functions index 9a47449b..ed318b0e 100644 --- a/sysconfig/network-scripts/network-functions +++ b/sysconfig/network-scripts/network-functions @@ -424,3 +424,26 @@ change_resolv_conf () fi; return $r; } + +# Logging function +# +# Usage: net_log <message> <err|warning|info> <optional file/function name> +# +# Default level is 'info'. + +net_log() { + local message="$1" + local level="$2" + local name="$3" + + [ -z "$message" ] && return 1 + [ -z "$level" ] && level=info + [ -z "$name" ] && name=$0 + + echo $message + + if [ -x /usr/bin/logger ]; then + /usr/bin/logger -p daemon.$level -t "$name" "$message" + fi + return 0 +} |