2024-01-14 18:43:11 -05:00
|
|
|
#!/bin/bash
|
|
|
|
#
|
|
|
|
# This script has been created as part of the Blueprint source code
|
2024-01-15 11:40:50 -05:00
|
|
|
# and uses the same license as the rest of the codebase.
|
2024-01-14 18:43:11 -05:00
|
|
|
|
|
|
|
PRINT() {
|
2024-07-16 07:25:55 -04:00
|
|
|
local DATE=""; DATE="$(date +"%H:%M:%S")"
|
|
|
|
local DATEDEBUG=""; DATEDEBUG="$(date +"%Y-%m-%d %H:%M:%S")"
|
2024-07-15 16:12:14 -04:00
|
|
|
local TYPE="$1"
|
|
|
|
local MESSAGE="$2"
|
2024-01-14 18:43:11 -05:00
|
|
|
|
2024-07-16 07:25:55 -04:00
|
|
|
local BOLD=""; BOLD="$(tput bold)"
|
|
|
|
local RESET=""; RESET="$(tput sgr0)"
|
2024-07-15 16:12:14 -04:00
|
|
|
local SECONDARY="\033[2m"
|
2024-07-16 07:25:55 -04:00
|
|
|
local PRIMARY=""
|
2024-01-14 18:43:11 -05:00
|
|
|
|
2024-07-16 07:25:55 -04:00
|
|
|
if [[ $TYPE == "INFO" ]]; then local ICON=""; local READABLETYPE="Info"; PRIMARY=$(tput setaf 4); fi
|
|
|
|
if [[ $TYPE == "WARNING" ]]; then local ICON=""; local READABLETYPE="Warning"; PRIMARY=$(tput setaf 3); fi
|
|
|
|
if [[ $TYPE == "FATAL" ]]; then local ICON=""; local READABLETYPE="Fatal"; PRIMARY=$(tput setaf 1); fi
|
|
|
|
if [[ $TYPE == "SUCCESS" ]]; then local ICON=""; local READABLETYPE="Success"; PRIMARY=$(tput setaf 2); fi
|
|
|
|
if [[ $TYPE == "INPUT" ]]; then local ICON=""; local READABLETYPE="Input"; PRIMARY=$(tput setaf 5); fi
|
2024-07-15 16:12:14 -04:00
|
|
|
if [[ $TYPE == "DEBUG" ]]; then local PRIMARY="$SECONDARY"; fi
|
2024-01-14 18:43:11 -05:00
|
|
|
|
2024-07-06 07:59:26 -04:00
|
|
|
if [[ $TYPE != "DEBUG" ]]; then echo -e "${SECONDARY}${DATE}${RESET} ${PRIMARY}${TYPE}:${RESET} $MESSAGE${RESET}"; fi
|
2024-01-15 12:05:22 -05:00
|
|
|
echo -e "${BOLD}${SECONDARY}$DATEDEBUG${RESET} ${PRIMARY}${TYPE}:${RESET} $MESSAGE" >> "$FOLDER"/.blueprint/extensions/blueprint/private/debug/logs.txt
|
2024-07-15 16:12:14 -04:00
|
|
|
}
|