diff --git a/functions/logger.sh b/functions/logger.sh index 9c2ea6c3..0b59cd65 100755 --- a/functions/logger.sh +++ b/functions/logger.sh @@ -85,14 +85,15 @@ log() { ;; esac - # Display the message in the terminal - echo -e "$colored_message" >&2 + if [[ ! $logging_level == "none" ]]; then + # Display the message in the terminal + echo -e "$colored_message" >&2 - # Write the log message to the log file - if [ ! -f "$logfile" ]; then - echo "$timestamp [WARN] Log file not found in \"$logfile\", creating it" >&2 - touch "$logfile" + # Write the log message to the log file + if [ ! -f "$logfile" ]; then + echo "$timestamp [WARN] Log file not found in \"$logfile\", creating it" >&2 + touch "$logfile" + fi + echo "$log_message" >> "$logfile" fi - echo "$log_message" >> "$logfile" - }