From 4508fadf6ab72a9d3591b12702c32aef9178babb Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Fri, 6 Jan 2023 22:05:33 -0600 Subject: Mess with logging Mostly aesthetic --- vienna | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/vienna b/vienna index 1d060ce..5ebdb93 100755 --- a/vienna +++ b/vienna @@ -98,13 +98,16 @@ main() { # doesn't exist, that's an error. If we're just looking for the # default file, however, there is no error---the user might want # to use the default configuration. - log "Can't find configuration \`$CONFIG'." + log error "Can't find configuration \`$CONFIG'." exit 2 fi ## Log configuration variables - log config "domain: $DOMAIN" - log config "workdir: $WORKD" - log config "output: $OUTD" + log config domain: "$DOMAIN" + log config workdir: "$WORKD" + log config output: "$OUTD" + log config page.tmpl: "$PAGE_TEMPLATE" + log config index.tmpl: "$INDEX_TEMPLATE" + log config feed.tmpl: "$FEED_TEMPLATE" ## Plugins # Plugins are .*.sh files in build directory. They're sourced here. if gencheckglob './.*.sh' ./.*.sh; then @@ -158,15 +161,15 @@ postprocess() { case "${1:-ok}" in ok) ;; publish) - log vienna "publish" + log vienna publish publish "$OUTD" ;; preview) - log vienna "preview" + log vienna preview preview "$OUTD" ;; *) - log vienna "Don't know command \`$1'." + log error "Don't know command \`$1'." exit 1 ;; esac @@ -207,9 +210,10 @@ EOF log() { if "$LOG"; then - t="$1" + printf >&2 '[%s] ' "$1" shift - echo >&2 "[$t]" "$@" + printf >&2 "%s\t" "$@" + echo >&2 fi } @@ -307,7 +311,7 @@ genpage() { # genpage PAGE... test -f "$PAGE_TEMPLATE" || return 1 gencheckglob "*.$PAGE_RAW_EXT" "$@" || set -- for FILE; do - log genpage "$FILE" + log genpage "$FILE" outd="$OUTD/${FILE%.$PAGE_RAW_EXT}" outf="$outd/index.html" tmpf="$TMPD/$FILE.tmp" @@ -328,7 +332,7 @@ genlist() { # genlist PERITEM_FUNC TEMPLATE_FILE PAGE... return fi for FILE; do - log genlist "$peritem_func: $template_file: $FILE" + log genlist "$peritem_func" "$FILE" LINK="$DOMAIN${DOMAIN:+/}${FILE%.$PAGE_RAW_EXT}" "$peritem_func" "$FILE" done | expand "$template_file" -- cgit 1.4.1-21-gabe81