New improved logging added. Logs are saved at /tmp/configure-stormux.log.

This commit is contained in:
Storm Dragon 2024-06-02 22:34:38 -04:00
parent 646657244e
commit 02cad9a079

View File

@ -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