This library is a single Bash file helping you to write logs with color in yours scripts.
To load and use this lib, just respect the following order.
The existing log levels are :
- $LOG_LEVEL_TRACE
- $LOG_LEVEL_DEBUG
- $LOG_LEVEL_INFOS
- $LOG_LEVEL_WARNING
- $LOG_LEVEL_ERROR
For instance : export LOG_LEVEL="$LOG_LEVEL_DEBUG"
For instance : export LOG_OUTPUT="/var/log/my-file.log"
or export LOG_OUTPUT=""
to redirect all logs in the current output (generally the console).
For instance :
. ./lib-logger.sh
LOGGER_logTrace "This log is written at TRACE level"
LOGGER_logDebug "This log is written at DEBUG level"
LOGGER_logInfo "This log is written at INFO level"
LOGGER_logWarning "This log is written at WARNING level"
LOGGER_logError "This log is written at ERROR level"