# 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 $@
}
