mirror of
https://github.com/docker-mailserver/docker-mailserver.git
synced 2025-07-10 01:15:00 +02:00
scripts: new log (#2493)
* added new `_log` function With `_log`, the `_notify` method wa rendered obsolete. `_notify` was not completely removed due to test failures in `check-for-changes.sh`. The new `_log` function properly uses log levels such as `trace`, `debug`, `info`, `warn` and `error`. It provides a cleaner solution and renders `DMS_DEBUG` obsolete too (as only `_notify` depends on it). * converted all helper script to new `_log` function * converted all startup stacks to new `log` function * `start-mailserver.sh` now uses new `_log` function * final test and misc small script adjustments * updated documentation
This commit is contained in:
parent
d8d4b6a189
commit
24031ae365
19 changed files with 367 additions and 221 deletions
|
@ -2,7 +2,14 @@
|
|||
|
||||
function _errex
|
||||
{
|
||||
echo -e "Error :: ${*}\nAborting." >&2
|
||||
if [[ -n ${1+set} ]]
|
||||
then
|
||||
_log 'error' "${1}"
|
||||
else
|
||||
_log 'error' "Call to '_errex' is missing a message to log"
|
||||
fi
|
||||
|
||||
_log 'error' 'Aborting'
|
||||
exit 1
|
||||
}
|
||||
|
||||
|
@ -62,13 +69,13 @@ function dms_panic__no_file { dms_panic 'no-file' "${1}" "${2}"; }
|
|||
function dms_panic__misconfigured { dms_panic 'misconfigured' "${1}" "${2}"; }
|
||||
function dms_panic__invalid_value { dms_panic 'invalid-value' "${1}" "${2}"; }
|
||||
|
||||
# Call this method when you want to panic (emit a 'FATAL' log level error, and exit uncleanly).
|
||||
# Call this method when you want to panic (i.e. emit an 'ERROR' log, and exit uncleanly).
|
||||
# `dms_panic` methods should be preferred if your failure type is supported.
|
||||
function _shutdown
|
||||
{
|
||||
local FATAL_ERROR_MESSAGE=$1
|
||||
_log 'error' "${1}"
|
||||
_log 'error' 'Shutting down'
|
||||
|
||||
_notify 'fatal' "${FATAL_ERROR_MESSAGE}"
|
||||
_notify 'err' "Shutting down.."
|
||||
kill 1
|
||||
exit 1
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue