Browse Source

Added new fn_script_log vars

Depending on the error the script log will now display PASS, FATAL,
ERROR, WARN, INFO in the log.
pull/914/head
Daniel Gibbs 9 years ago
parent
commit
f5d765dbff
  1. 46
      lgsm/functions/core_messages.sh

46
lgsm/functions/core_messages.sh

@ -11,7 +11,7 @@ lgsm_version="210516"
# Date, servicename & module details displayed in log files.
# e.g Feb 28 14:56:58 ut99-server: Monitor:
fn_scriptlog(){
fn_script_log(){
if [ -n "${modulename}" ]; then
echo -e "$(date '+%b %d %H:%M:%S') ${servicename}: ${modulename}: ${1}" >> "${scriptlog}"
else
@ -19,6 +19,50 @@ fn_scriptlog(){
fi
}
fn_script_log_pass(){
if [ -n "${modulename}" ]; then
echo -e "$(date '+%b %d %H:%M:%S') ${servicename}: ${modulename}: PASS: ${1}" >> "${scriptlog}"
else
echo -e "$(date '+%b %d %H:%M:%S') ${servicename}: PASS: ${1}" >> "${scriptlog}"
fi
exitcode=0
}
fn_script_log_fatal(){
if [ -n "${modulename}" ]; then
echo -e "$(date '+%b %d %H:%M:%S') ${servicename}: ${modulename}: FATAL: ${1}" >> "${scriptlog}"
else
echo -e "$(date '+%b %d %H:%M:%S') ${servicename}: FATAL: ${1}" >> "${scriptlog}"
fi
exitcode=1
}
fn_script_log_error(){
if [ -n "${modulename}" ]; then
echo -e "$(date '+%b %d %H:%M:%S') ${servicename}: ${modulename}: ERROR: ${1}" >> "${scriptlog}"
else
echo -e "$(date '+%b %d %H:%M:%S') ${servicename}: ERROR: ${1}" >> "${scriptlog}"
fi
exitcode=2
}
fn_script_log_warn(){
if [ -n "${modulename}" ]; then
echo -e "$(date '+%b %d %H:%M:%S') ${servicename}: ${modulename}: WARN: ${1}" >> "${scriptlog}"
else
echo -e "$(date '+%b %d %H:%M:%S') ${servicename}: WARN: ${1}" >> "${scriptlog}"
fi
exitcode=3
}
fn_script_log_info(){
if [ -n "${modulename}" ]; then
echo -e "$(date '+%b %d %H:%M:%S') ${servicename}: ${modulename}: INFO: ${1}" >> "${scriptlog}"
else
echo -e "$(date '+%b %d %H:%M:%S') ${servicename}: INFO: ${1}" >> "${scriptlog}"
fi
}
# [ FAIL ]
fn_print_fail(){
if [ -n "${modulename}" ]; then

Loading…
Cancel
Save