metascript and printclonedep
will move to metascript Signed-off-by: philippe lhardy <philippe.lhardy@astrolabe.coop>
This commit is contained in:
43
lib/log_functions.sh
Normal file
43
lib/log_functions.sh
Normal file
@@ -0,0 +1,43 @@
|
||||
# SHOULD BE INCLUDED WITH source or . from a bash script
|
||||
|
||||
# EXAMPLE
|
||||
# log_functions=./log_functions.sh
|
||||
# [[ -f $log_functions ]] || { echo "[FATAL] Missing $log_functions" >&2 ; exit 1 ;}
|
||||
# source $log_functions
|
||||
|
||||
log_any()
|
||||
{
|
||||
priority=$1
|
||||
shift
|
||||
echo "[$priority] $@" >&2
|
||||
}
|
||||
|
||||
log_fatal()
|
||||
{
|
||||
log_any FATAL "$*"
|
||||
}
|
||||
|
||||
log_error()
|
||||
{
|
||||
log_any ERROR "$*"
|
||||
}
|
||||
|
||||
log_warn()
|
||||
{
|
||||
log_any WARN "$*"
|
||||
}
|
||||
|
||||
log_info()
|
||||
{
|
||||
log_any INFO "$*"
|
||||
}
|
||||
|
||||
log_debug()
|
||||
{
|
||||
[[ -n $debug ]] && log_any DEBUG "$*"
|
||||
}
|
||||
|
||||
verbose()
|
||||
{
|
||||
[[ -n $verbose ]] && log_any $verbose $@
|
||||
}
|
||||
Reference in New Issue
Block a user