Skip to content

Instantly share code, notes, and snippets.

@akskap
Created October 12, 2019 06:36
Show Gist options
  • Save akskap/d70d3bbc7f89f702fc57b0e7e99f3815 to your computer and use it in GitHub Desktop.
Save akskap/d70d3bbc7f89f702fc57b0e7e99f3815 to your computer and use it in GitHub Desktop.
Logger Functions in bash
#!/usr/bin/env bash
function __msg_error() {
[[ "${ERROR}" == "1" ]] && echo -e "[ERROR]: $*"
}
function __msg_debug() {
[[ "${DEBUG}" == "1" ]] && echo -e "[DEBUG]: $*"
}
function __msg_info() {
[[ "${INFO}" == "1" ]] && echo -e "[INFO]: $*"
}
__msg_error "File could not be found. Cannot proceed"
__msg_debug "Starting script execution with 276MB of available RAM"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment