summaryrefslogtreecommitdiff
path: root/src/etc/dhcp/dhclient-enter-hooks.d/01-vyos-logging
blob: 121fb21be50b2929b3ea3be27a265e5fbbc9fc9e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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
}