Last active
August 1, 2022 09:09
-
-
Save mxyq/04dac8859b735309e1efe28978aafb55 to your computer and use it in GitHub Desktop.
[Log] #Bash #Log
This file contains hidden or 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
_printargs() { | |
printf -- "%s" "$1" | |
printf "\n" | |
} | |
_info() { | |
_printargs "$@" | |
} | |
LOGFILE="/opt/backup/mysqldb/backup.log" | |
log() { | |
echo "$(date "+%Y-%m-%d %H:%M:%S")" "$1" | |
echo -e "$(date "+%Y-%m-%d %H:%M:%S")" "$1" >> ${LOGFILE} | |
} | |
function log_msg { | |
echo "[`date '+ %F %T'` ]: $@" | |
} | |
$ log_msg "This is sample log message" | |
[ 2018-08-16 19:56:34 ]: This is sample log message |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment