Created
February 22, 2024 18:03
-
-
Save nol166/2a6f64963abbc4383b3dcab2fb230390 to your computer and use it in GitHub Desktop.
easier to read instruqt logs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Check if a track ID is provided | |
if [ "$#" -ne 1 ]; then | |
echo "Usage: $0 <track-id>" | |
exit 1 | |
fi | |
TRACK_ID="$1" | |
bold_if_special() { | |
local line="$1" | |
case "$line" in | |
*"Starting script: setup-mongodb"* | \ | |
*"Finished running script: setup-mongodb"* | \ | |
*"Starting script: check-mongodb"* | \ | |
*"check-mongodb: Process exited with status 1"* | \ | |
*"script was aborted"* | \ | |
*"Finished running script: cleanup-mongodb"* | \ | |
*"All scripts completed for action: setup"* | \ | |
*"Starting script: solve-mongodb"* | \ | |
*"Finished running script: solve-mongodb"* | \ | |
*"Starting script: cleanup-mongodb"* | \ | |
*"All scripts completed for action: cleanup"*) | |
echo -e "\033[1m$line\033[0m" | |
;; | |
*) | |
echo "$line" | |
;; | |
esac | |
} | |
instruqt track logs "$TRACK_ID" | while read -r line; do | |
filtered_line=$(echo "$line" | sed -e 's/.*INFO: //') | |
bold_if_special "$filtered_line" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment