From ef9e238aa6334d5dddd33438a53cf210a9a38198 Mon Sep 17 00:00:00 2001 From: "pavel.muhortov" Date: Sat, 7 Jan 2023 09:20:52 +0300 Subject: [PATCH] simple logger added --- script.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/script.sh b/script.sh index 4d658f8..45b48e0 100644 --- a/script.sh +++ b/script.sh @@ -15,18 +15,22 @@ ## FUNCTIONS # +addtologs() { + echo "$(date +'%Y.%m.%d-%H:%M:%S') $1" | tee -a $logs +} + execpause() { read -p "Press [ENTER] to continue... " } execquite() { - echo "$(date +'%Y.%m.%d-%H:%M:%S') execution time is $(($(date +%s)-$time)) seconds, exit" | tee -a $logs + addtologs "execution time is $(($(date +%s)-$time)) seconds, exit" if [ "${show}" != "qn" ];then execpause fi exit } execerror() { - echo "$(date +'%Y.%m.%d-%H:%M:%S') error: $1" | tee -a $logs + addtologs "error: $1" execquite } getconfig() {