fixed logging output
This commit is contained in:
parent
d388db110f
commit
83c236c74c
1 changed files with 16 additions and 12 deletions
16
functions
16
functions
|
|
@ -2,7 +2,7 @@
|
||||||
# pyr0ball script functions library
|
# pyr0ball script functions library
|
||||||
|
|
||||||
# Initial Vars
|
# Initial Vars
|
||||||
functionsrev=1.1.1
|
functionsrev=1.1.2
|
||||||
scriptname="${0##*/}"
|
scriptname="${0##*/}"
|
||||||
rundir="${0%/*}"
|
rundir="${0%/*}"
|
||||||
rundir_absolute=$(cd `dirname $0` && pwd)
|
rundir_absolute=$(cd `dirname $0` && pwd)
|
||||||
|
|
@ -495,24 +495,27 @@ boxborder(){
|
||||||
}
|
}
|
||||||
|
|
||||||
success(){
|
success(){
|
||||||
|
_line="$@"
|
||||||
echo -e "\n"
|
echo -e "\n"
|
||||||
boxborder " ${scriptname} ${grn}SUCCESS${dfl}$@"
|
boxborder "${scriptname} ${grn}SUCCESS${dfl} ${_line}"
|
||||||
exit 0
|
exit 0
|
||||||
}
|
}
|
||||||
|
|
||||||
warn(){
|
warn(){
|
||||||
echo -e "\n"
|
|
||||||
ec=$?
|
ec=$?
|
||||||
|
_line="$@"
|
||||||
|
echo -e "\n"
|
||||||
boxtop
|
boxtop
|
||||||
boxline "${lrd}WARNING${lyl}[${ong}code=${red}$ec${lyl}]: $@${dfl}"
|
boxline "${lrd}WARNING${lyl}[${ong}code=${red}$ec${lyl}]: ${_line}${dfl}"
|
||||||
boxbottom
|
boxbottom
|
||||||
}
|
}
|
||||||
|
|
||||||
fail(){
|
fail(){
|
||||||
ec=$?
|
ec=$?
|
||||||
|
_line="$@"
|
||||||
echo -e "\n"
|
echo -e "\n"
|
||||||
boxtop
|
boxtop
|
||||||
boxline "${lrd}FAILED${lyl}[${ong}code=${red}$ec${lyl}]: $@${dfl}"
|
boxline "${lrd}FAILED${lyl}[${ong}code=${red}$ec${lyl}]: ${_line}${dfl}"
|
||||||
boxbottom
|
boxbottom
|
||||||
exit $ec
|
exit $ec
|
||||||
}
|
}
|
||||||
|
|
@ -536,7 +539,8 @@ logger(){
|
||||||
#$@ 2>&1 | tee >(ts "[$scriptname][%d-%m-%y %H_%M_%S]" > $logfile) # This version of prepend requires the 'ts' utility from 'moreutils' package
|
#$@ 2>&1 | tee >(ts "[$scriptname][%d-%m-%y %H_%M_%S]" > $logfile) # This version of prepend requires the 'ts' utility from 'moreutils' package
|
||||||
$@ 2>&1 | tee >(
|
$@ 2>&1 | tee >(
|
||||||
while IFS= read -r line; do
|
while IFS= read -r line; do
|
||||||
printf '[%s] %s\n' "${scriptname}][${pretty_date}" "$line"
|
_line=$(echo $line | sed "s,\x1B\[[0-9;]*[mK],,g" | tr -dc '[:print:]')
|
||||||
|
printf '[%s] %s\n' "${scriptname}][${prettyDate}" "$_line"
|
||||||
done >> $logfile
|
done >> $logfile
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue