- Include logging to script
dir="`dirname \"$0\"`"
source $dir/functions/logging.sh
or
source <(curl -s https://gist.githubusercontent.com/atom-tr/4966c70f369401125f55c41e8f7b24fa/raw/9b6902e7b5f32460043f1a223b5ab343bb46c26d/logging.sh)
- [Option] Start writing logs to a special file.
If use this, logs will be print console and write logs to file
basename=`basename $0` # Get script name
log="$dir/logs/${basename%.*}.log" # Get log file path
start_write_log $log # this will start writing logs to file
- Use
logging "Start script $0"
log.info "Getting info ... "
raise_error "exists!";