Last active
July 23, 2020 11:19
-
-
Save cakyus/666970c6ffd12ee4f550d42d852ae738 to your computer and use it in GitHub Desktop.
Bash Command Line
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ -z "$DEBUG" ]; then | |
DEBUG=0 | |
fi | |
LOG_FILE=$( dirname $0 )/$( basename $0 .bash ).$( date +'%Y%m%d' ).log | |
logger_debug(){ | |
if [ $DEBUG -eq 1 ]; then | |
>&2 echo $( date +'%Y-%m-%d+%H:%M:%S' ) DEBUG ${FUNCNAME[1]} $* | |
else | |
>&2 echo $( date +'%Y-%m-%d+%H:%M:%S' ) DEBUG ${FUNCNAME[1]} $* >> $LOG_FILE | |
fi | |
} | |
logger_error(){ | |
>&2 echo $( date +'%Y-%m-%d+%H:%M:%S' ) ERROR ${FUNCNAME[1]} $* | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment