feat: Update log()
This commit is contained in:
		@@ -26,9 +26,6 @@ log() {
 | 
			
		||||
 | 
			
		||||
    local message
 | 
			
		||||
    local print
 | 
			
		||||
    local log_file
 | 
			
		||||
 | 
			
		||||
    log_file="$__log_file"
 | 
			
		||||
 | 
			
		||||
    # Read message from STDIN if args not passed.
 | 
			
		||||
    [[ ! -t 0 ]] || [[ "$#" == 0 ]] && message="$(cat <&0)"
 | 
			
		||||
@@ -48,7 +45,7 @@ log() {
 | 
			
		||||
 | 
			
		||||
    while read -r line; do
 | 
			
		||||
        if [[ "$line" ]]; then
 | 
			
		||||
            printf '[%s] [%s] %s\n' "$(date +"$log_date_fmt")" "$0" "$line" >> "$log_file"
 | 
			
		||||
            printf '[%s] %s\n' "$(date +"$log_date_fmt")" "$line" >> "$__log_file"
 | 
			
		||||
        fi
 | 
			
		||||
    done <<< "$(sed -r 's/\x1B\[(([0-9]+)(;[0-9]+)*)?[m,K,H,f,J]//g' <<< "$message")"
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user