]> git.ipfire.org Git - people/arne_f/network.git/blob - functions.logging
network: Magnificent changes on code.
[people/arne_f/network.git] / functions.logging
1 #!/bin/bash
2
3 LOG_FACILITY="network"
4 LOG_LEVEL="DEBUG"
5
6 function log() {
7 local level=${1}
8 shift
9 local message="$@"
10
11 if [ -z "${DEBUG}" ] && [ "${level}" = "DEBUG" ]; then
12 return
13 fi
14
15 # Set a prefix if we are in a hook.
16 if [ -n "${HOOK}" ]; then
17 message="${HOOK}: ${message}"
18 fi
19
20 logger -t ${LOG_FACILITY} "${message}"
21 }