mirror of
https://github.com/super-linter/super-linter.git
synced 2024-11-25 15:41:02 -05:00
fix: fix log level variable assignment (#5319)
Correctly declare log level variables when initializing the logging infrastructure.
This commit is contained in:
parent
0f91a56f21
commit
52b082b1f6
1 changed files with 12 additions and 11 deletions
|
@ -25,11 +25,11 @@ fi
|
||||||
|
|
||||||
declare -l LOG_DEBUG
|
declare -l LOG_DEBUG
|
||||||
LOG_DEBUG="false"
|
LOG_DEBUG="false"
|
||||||
declare -l LOG_ERROR
|
declare -l LOG_VERBOSE
|
||||||
LOG_VERBOSE="false"
|
LOG_VERBOSE="false"
|
||||||
declare -l LOG_ERROR
|
declare -l LOG_NOTICE
|
||||||
LOG_NOTICE="false"
|
LOG_NOTICE="false"
|
||||||
declare -l LOG_ERROR
|
declare -l LOG_WARN
|
||||||
LOG_WARN="false"
|
LOG_WARN="false"
|
||||||
declare -l LOG_ERROR
|
declare -l LOG_ERROR
|
||||||
LOG_ERROR="false"
|
LOG_ERROR="false"
|
||||||
|
@ -74,8 +74,8 @@ LOG_TEMP=$(mktemp) || echo "Failed to create temporary log file."
|
||||||
export LOG_TEMP
|
export LOG_TEMP
|
||||||
|
|
||||||
log() {
|
log() {
|
||||||
local TOTERM=${1:-}
|
local PRINT_TO_STDOUT="${1}"
|
||||||
local MESSAGE=${2:-}
|
local MESSAGE="${2}"
|
||||||
local LOG_LEVEL_LABEL="${3}"
|
local LOG_LEVEL_LABEL="${3}"
|
||||||
|
|
||||||
local LOG_MESSAGE_DATE
|
local LOG_MESSAGE_DATE
|
||||||
|
@ -106,7 +106,7 @@ log() {
|
||||||
local MESSAGE_FOR_LOG_FILE
|
local MESSAGE_FOR_LOG_FILE
|
||||||
MESSAGE_FOR_LOG_FILE="${LOG_MESSAGE_DATE} ${LOG_LEVEL_LABEL} ${MESSAGE}"
|
MESSAGE_FOR_LOG_FILE="${LOG_MESSAGE_DATE} ${LOG_LEVEL_LABEL} ${MESSAGE}"
|
||||||
|
|
||||||
if [[ -n ${TOTERM} ]]; then
|
if [[ "${PRINT_TO_STDOUT}" == "true" ]]; then
|
||||||
echo -e "${COLORED_MESSAGE}"
|
echo -e "${COLORED_MESSAGE}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -115,17 +115,18 @@ log() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
debug() { log "${LOG_DEBUG:-}" "$*" "DEBUG"; }
|
debug() { log "${LOG_DEBUG}" "$*" "DEBUG"; }
|
||||||
info() { log "${LOG_VERBOSE:-}" "$*" "INFO"; }
|
info() { log "${LOG_VERBOSE}" "$*" "INFO"; }
|
||||||
notice() { log "${LOG_NOTICE:-}" "$*" "NOTICE"; }
|
notice() { log "${LOG_NOTICE}" "$*" "NOTICE"; }
|
||||||
warn() { log "${LOG_WARN:-}" "$*" "WARN"; }
|
warn() { log "${LOG_WARN}" "$*" "WARN"; }
|
||||||
error() { log "${LOG_ERROR:-}" "$*" "ERROR"; }
|
error() { log "${LOG_ERROR}" "$*" "ERROR"; }
|
||||||
fatal() {
|
fatal() {
|
||||||
log "true" "$*" "FATAL"
|
log "true" "$*" "FATAL"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
debug "LOG_LEVEL is set to: ${LOG_LEVEL}"
|
debug "LOG_LEVEL is set to: ${LOG_LEVEL}"
|
||||||
|
debug "Log level variables. LOG_DEBUG: ${LOG_DEBUG}, LOG_VERBOSE: ${LOG_VERBOSE}, LOG_NOTICE: ${LOG_NOTICE}. LOG_WARN: ${LOG_WARN}, LOG_ERROR: ${LOG_ERROR}"
|
||||||
|
|
||||||
# shellcheck disable=SC2034 # Variable is referenced in other files
|
# shellcheck disable=SC2034 # Variable is referenced in other files
|
||||||
SUPER_LINTER_INITIALIZATION_LOG_GROUP_TITLE="Super-Linter initialization"
|
SUPER_LINTER_INITIALIZATION_LOG_GROUP_TITLE="Super-Linter initialization"
|
||||||
|
|
Loading…
Reference in a new issue