# Copyright (c) 2018 - 2022, Martin Scheidt (ISC license)
# Permission to use, copy, modify, and/or distribute this file for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
## -- log functions
# Halt on error
set -e
ECHO=`which echo`
error_occured=0
exec 3>&2# logging stream (file descriptor 3) defaults to STDERR
verbosity=2# default to show warnings
silent_lvl=0
err_lvl=1
wrn_lvl=2
inf_lvl=3
dbg_lvl=4
log_n(){ log $silent_lvl"NOTE: $1";}# Always prints
log_e(){ log $err_lvl"ERROR: $1";}
log_w(){ log $wrn_lvl"WARNING: $1";}
log_i(){ log $inf_lvl"INFO: $1";}# "info" is already a command