码迷,mamicode.com
首页 > 系统相关 > 详细

【Shell】公共类-logger

时间:2020-01-28 17:50:32      阅读:99      评论:0      收藏:0      [点我收藏+]

标签:pre   string   div   debug   nbsp   class   his   deb   UNC   

#!/bin/bash

function debug()
{   
    date=`date +%Y/%m/%d-%H:%M:%S`
    #echo -e "[DEBUG]\t${date} "········ "$*"
    echo -e "\033[37m[DEBUG]\t${date} "··· "\033[0m\033[37m$*\033[0m"
}
function info()
{
    date=`date +%Y/%m/%d-%H:%M:%S`
    #echo -e "[INFO]\t${date} "········ "$*"
    echo -e "\033[32m[INFO]\t${date} "··· "\033[0m\033[32m$*\033[0m"
}
function warn()
{
    date=`date +%Y/%m/%d-%H:%M:%S`
    #echo -e "[WARN]\t${date} "········ "$*"
    echo -e "\033[33m[WARN]\t${date} "··· "\033[0m\033[33m$*\033[0m"
}
function error()
{
    date=`date +%Y/%m/%d-%H:%M:%S`
    #echo -e "[ERROR]\t${date} "··· "$*"
    echo -e "\033[31m[ERROR]\t${date} "··· "\033[0m\033[31m$*\033[0m"
}

debug "this is a debug string"
info "this is a test string"
error "this is a error info"

 

【Shell】公共类-logger

标签:pre   string   div   debug   nbsp   class   his   deb   UNC   

原文地址:https://www.cnblogs.com/haohaozhang/p/11830665.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!