Shell公共类-logger

Posted haohaozhang

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Shell公共类-logger相关的知识,希望对你有一定的参考价值。

#!/bin/bash

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

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

 

以上是关于Shell公共类-logger的主要内容,如果未能解决你的问题,请参考以下文章