summaryrefslogtreecommitdiff
path: root/src/etc/dhcp/dhclient-enter-hooks.d/01-vyos-logging
diff options
context:
space:
mode:
Diffstat (limited to 'src/etc/dhcp/dhclient-enter-hooks.d/01-vyos-logging')
-rw-r--r--src/etc/dhcp/dhclient-enter-hooks.d/01-vyos-logging20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/etc/dhcp/dhclient-enter-hooks.d/01-vyos-logging b/src/etc/dhcp/dhclient-enter-hooks.d/01-vyos-logging
new file mode 100644
index 000000000..121fb21be
--- /dev/null
+++ b/src/etc/dhcp/dhclient-enter-hooks.d/01-vyos-logging
@@ -0,0 +1,20 @@
+# enable logging
+LOG_ENABLE="yes"
+LOG_STDERR="no"
+LOG_TAG="dhclient-script-vyos"
+
+function logmsg () {
+ # log message to journal
+ case $1 in
+ error) LOG_PRIO="daemon.err" ;;
+ info) LOG_PRIO="daemon.info" ;;
+ esac
+
+ if [ "${LOG_ENABLE}" == "yes" ] ; then
+ if [ "${LOG_STDERR}" == "yes" ] ; then
+ /usr/bin/logger -e --id=$$ -s -p ${LOG_PRIO} -t ${LOG_TAG} "${@:2}"
+ else
+ /usr/bin/logger -e --id=$$ -p ${LOG_PRIO} -t ${LOG_TAG} "${@:2}"
+ fi
+ fi
+}