#!/bin/bash
#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#
#   @filename: typeface
#   @author: 沈风
#   @date: 2024-09-23 10:58
#   @description: 艺术字体
#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#
function LoggerUtil_info() {
  LoggerUtil_logfun "$1" "INFO" "green"
}

function LoggerUtil_error() {
  LoggerUtil_logfun "$1" "ERROR" "red"
}

function LoggerUtil_warn() {
  LoggerUtil_logfun "$1" "WARN" "yellow"
}

function LoggerUtil_debug() {
  LoggerUtil_logfun "$1" "DEBUG" "blue"
}

function LoggerUtil_basics() {
  LoggerUtil_logfun "$1" "DEBUG" "$2"
}

function LoggerUtil_logfun() {
  log_str=$1
  log_level=$2
  log_color=$3
  time_str=$(date +"%Y-%m-%d %H:%M:%S")

  case $log_color in
    red)
      log_str="\e[31m ${log_str} \e[0m"
    ;;
    green)
      log_str="\e[32m ${log_str} \e[0m"
    ;;
    yellow)
      log_str="\e[33m ${log_str} \e[0m"
    ;;
    blue)
       log_str="\e[34m ${log_str} \e[0m"
    ;;
    purple)
      log_str="\e[35m ${log_str} \e[0m"
    ;;
    cyan)
     log_str="\e[36m ${log_str} \e[0m"
    ;;
  esac

  echo_str="${time_str} ${log_level} ${log_str}"
  echo -e "${echo_str}"
}
