diff --git a/config.sh b/config.sh index 1392d00..cbad22d 100755 --- a/config.sh +++ b/config.sh @@ -5,5 +5,8 @@ WEBROOT="/tmp/webroot" ACME_PATH=".well-known/acme-challenge" LOCK_FILE="/tmp/certbot.lck" +LOGGER_USE_TS=1 +SCRIPT_NAME=${0##*/} + mkdir -p "$WEBROOT/$ACME_PATH" "$LE_DIR/failed" echo "ok" > "$WEBROOT/$ACME_PATH/test.txt" diff --git a/logger.sh b/logger.sh index 60fa156..f201fd6 100644 --- a/logger.sh +++ b/logger.sh @@ -19,15 +19,19 @@ log() { esac reset=$'\e[39m' - timestamp=$(date +"%Y-%m-%d %H:%M:%S") + if [[ -n $LOGGER_USE_TS ]]; then + timestamp=$(date +"%Y-%m-%d %H:%M:%S|") + else + timestamp="" + fi if [[ -t 1 || -n $CONTENT_TYPE ]]; then - echo -e "${color}-${level:0:1}|${timestamp}|${message}${reset}" + echo -e "${color}-${level:0:1}|${timestamp}${message}${reset}" else - echo "-${level:0:1}|${timestamp}|${message}" + echo "-${level:0:1}|${timestamp}${message}" fi - logger -t SCRIPT_NAME -p user.${level,,} "${timestamp} - ${level} - ${message}" + logger -t $SCRIPT_NAME -p user.${level,,} "${level} - ${message}" } log_info() {