aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBill Nottingham <notting@redhat.com>2011-03-25 15:57:14 -0400
committerHarald Hoyer <harald@redhat.com>2011-06-01 15:23:34 +0200
commit9be3ca9241a028e1d8052e7561691586f20ff47a (patch)
tree502c54280dd4934dcab0456e7aa83185e9f52630
parent35a0f1ba2f18115d71b910fd6bd1f5c2f9c3c2ff (diff)
downloadinitscripts-9be3ca9241a028e1d8052e7561691586f20ff47a.tar
initscripts-9be3ca9241a028e1d8052e7561691586f20ff47a.tar.gz
initscripts-9be3ca9241a028e1d8052e7561691586f20ff47a.tar.bz2
initscripts-9be3ca9241a028e1d8052e7561691586f20ff47a.tar.xz
initscripts-9be3ca9241a028e1d8052e7561691586f20ff47a.zip
Add a net_log() function. (#507515, #689525)
-rw-r--r--sysconfig/network-scripts/network-functions23
1 files changed, 23 insertions, 0 deletions
diff --git a/sysconfig/network-scripts/network-functions b/sysconfig/network-scripts/network-functions
index 6ae73706..f636ce89 100644
--- a/sysconfig/network-scripts/network-functions
+++ b/sysconfig/network-scripts/network-functions
@@ -438,3 +438,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
+}