From 02cad9a079ea45bcda70bb78021bb0fcecb3ce50 Mon Sep 17 00:00:00 2001 From: Storm Dragon Date: Sun, 2 Jun 2024 22:34:38 -0400 Subject: [PATCH] New improved logging added. Logs are saved at /tmp/configure-stormux.log. --- configure-stormux.sh | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/configure-stormux.sh b/configure-stormux.sh index f1a7db4..20d9606 100755 --- a/configure-stormux.sh +++ b/configure-stormux.sh @@ -28,6 +28,29 @@ if [[ "$(whoami)" == "root" ]]; then exit 0 fi +# Set up logging +logFile="/tmp/configure-stormux.log" +filter_ansi() { + sed -r -e 's/\x1B\[[0-9;]*[A-Za-z]//g' \ + -e 's/\x1B[()#][0-9A-Za-z]//g' \ + -e 's/\x1B[><=]//g' \ + -e 's/\x0F//g' \ + -e 's/\x1B\[?[0-9;]*[A-Za-z]//g' \ + -e 's/\x1B\][0-9]*;[^\x07]*\x07//g' \ + -e 's/\x1B\][0-9]*;[^\x1B]*\x1B\\//g' \ + -e 's/\x08//g' \ + -e 's/\r//g' \ + -e 's/\x1B\[\?1049[hl]//g' \ + -e 's/\x1B\[\?1[hl]//g' \ + -e 's/\x1B\[\?1000[hl]//g' \ + -e '/^[[:space:]]*$/d' \ + -e ':a;N;$!ba;s/\n{2,}/\n/g' +} + + +exec > >(stdbuf -oL tee >(filter_ansi >> "$logFile")) 2> >(stdbuf -oL tee >(filter_ansi >> "$logFile") >&2) + + # For audible sudo prompts: unset sudoFlags if [[ -x /etc/audibleprompt.sh ]]; then