From 3c62e60e31385b684934aa4bd8459e86f4c32b4f Mon Sep 17 00:00:00 2001 From: pabera <1260686+pabera@users.noreply.github.com> Date: Mon, 11 Dec 2023 13:13:33 +0100 Subject: [PATCH] Rename function to run_and_print_lc --- installation/README.md | 10 +++++----- installation/includes/02_helpers.sh | 2 +- installation/install-jukebox.sh | 2 +- installation/routines/setup_rfid_reader.sh | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/installation/README.md b/installation/README.md index ab789ac07..12af5fbed 100644 --- a/installation/README.md +++ b/installation/README.md @@ -3,11 +3,11 @@ ## Logging - Bash Script output rules ```bash -print_lc "This message will be logged to both console and logfile" -print_c "This message will only be logged to the console" -log "This message will only be logged to the logfile" -run_and_log "Run a command and log its output to logfile" -clear_c "Clears the console screen" +run_and_print_lc "Run a command and log its output to logfile" +print_lc "This message will be logged to both console and logfile" +print_c "This message will only be logged to the console" +log "This message will only be logged to the logfile" +clear_c "Clears the console screen" ``` [Learn more about bash script outputs](https://stackoverflow.com/questions/18460186/writing-outputs-to-log-file-and-console) diff --git a/installation/includes/02_helpers.sh b/installation/includes/02_helpers.sh index 3d91c799c..7520241c6 100644 --- a/installation/includes/02_helpers.sh +++ b/installation/includes/02_helpers.sh @@ -17,7 +17,7 @@ run_with_timer() { $1; # Executes the function passed as an argument - run_and_log calc_runtime_and_print time_start $(date +%s) + run_and_print_lc calc_runtime_and_print time_start $(date +%s) } run_with_log_frame() { diff --git a/installation/install-jukebox.sh b/installation/install-jukebox.sh index 8090989a2..84827f99d 100755 --- a/installation/install-jukebox.sh +++ b/installation/install-jukebox.sh @@ -51,7 +51,7 @@ log() { } # Function to run a command where the output will be logged to both console and logfile -run_and_log() { +run_and_print_lc() { "$@" | tee /dev/fd/3 } diff --git a/installation/routines/setup_rfid_reader.sh b/installation/routines/setup_rfid_reader.sh index f633bcdaf..3003d79a4 100644 --- a/installation/routines/setup_rfid_reader.sh +++ b/installation/routines/setup_rfid_reader.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash _run_setup_rfid_reader() { - run_and_log python "${INSTALLATION_PATH}/src/jukebox/run_register_rfid_reader.py" + run_and_print_lc python "${INSTALLATION_PATH}/src/jukebox/run_register_rfid_reader.py" } setup_rfid_reader() {