gh-92: Fallback to file logging if system loggers not available

Closes #92
pull/100/merge
Vlastimil Holer 7 years ago
parent 3d613abe06
commit 752c237a45
No known key found for this signature in database
GPG Key ID: EB549BADEFD07C53

@ -57,7 +57,12 @@ function log
-p "${SYSLOG_FACILITY}.${1}" \ -p "${SYSLOG_FACILITY}.${1}" \
"${2}" 2>/dev/null "${2}" 2>/dev/null
elif [ "${1}" != 'debug' ]; then if [ "$?" = "0" ]; then
return 0
fi
fi
if [ "${1}" != 'debug' ]; then
local _txt="$(date "+%b %d %T") $(hostname -s) ${SYSLOG_TAG}: ${2}" local _txt="$(date "+%b %d %T") $(hostname -s) ${SYSLOG_TAG}: ${2}"
local _log=/var/log/messages local _log=/var/log/messages
@ -68,6 +73,8 @@ function log
echo "${_txt}" >>"${_log}" 2>/dev/null echo "${_txt}" >>"${_log}" 2>/dev/null
fi fi
fi fi
return 0
} }
function export_rc_vars function export_rc_vars

Loading…
Cancel
Save