Add log messages
This commit is contained in:
parent
88629c9467
commit
1ed7791527
1 changed files with 17 additions and 6 deletions
|
@ -6,10 +6,6 @@ HOOK_PATH=${HOOK_PATH%/*}
|
|||
|
||||
export HOOK_PATH
|
||||
|
||||
err_trap() {
|
||||
echo "Error: $BASH_COMMAND"
|
||||
}
|
||||
|
||||
if [[ $PINCH_DEBUG -eq 1 ]]; then
|
||||
pdebug() {
|
||||
echo -e "\033[33m(DEBUG)\033[0m $@"
|
||||
|
@ -21,9 +17,22 @@ else
|
|||
fi
|
||||
|
||||
pinfo() {
|
||||
echo -e "\033[32m=>\033[0m $@"
|
||||
echo -e "\033[1;32m=>\033[0m $@"
|
||||
}
|
||||
|
||||
pwarn() {
|
||||
echo -e "\033[1;33m(warning) =>\033[0m $@"
|
||||
}
|
||||
|
||||
perror() {
|
||||
echo -e "\033[1;31m(error) =>\033[0m $@"
|
||||
}
|
||||
|
||||
err_trap() {
|
||||
perror "Error during execution of $EXEC_NAME."
|
||||
}
|
||||
|
||||
export -f pinfo pwarn perror
|
||||
export -f pdebug
|
||||
export -f err_trap
|
||||
|
||||
|
@ -35,6 +44,7 @@ exec_custom() {
|
|||
for hook in $(ls $hooks_path); do
|
||||
if [ -x $hooks_path/$hook ]; then
|
||||
pdebug "Executing custom hook $hooks_path/$hook"
|
||||
export EXEC_NAME="custom::$(basename $0)::$hook"
|
||||
$hooks_path/$hook $HOOK_ARGS
|
||||
fi
|
||||
done
|
||||
|
@ -44,6 +54,7 @@ exec_all() {
|
|||
for file in $(ls $1 | sort); do
|
||||
if [ -x $1/$file ]; then
|
||||
pdebug "Executing hook $1/$file"
|
||||
export EXEC_NAME="$(basename $0)::$file"
|
||||
$1/$file $HOOK_ARGS
|
||||
fi
|
||||
done
|
||||
|
|
Loading…
Reference in a new issue