Adds debug on/off check command

This commit is contained in:
Franck Nijhof 2019-03-14 19:39:26 +01:00
parent 2346cddca2
commit 6cd2579672
No known key found for this signature in database
GPG key ID: D62583BA8AB11CA3
2 changed files with 21 additions and 0 deletions

View file

@ -54,6 +54,8 @@ source "${__BASHIO_LIB_DIR}/addons.sh"
source "${__BASHIO_LIB_DIR}/api.sh"
# shellcheck source=config.sh
source "${__BASHIO_LIB_DIR}/config.sh"
# shellcheck source=debug.sh
source "${__BASHIO_LIB_DIR}/debug.sh"
# shellcheck source=exit.sh
source "${__BASHIO_LIB_DIR}/exit.sh"
# shellcheck source=hardware.sh

19
lib/debug.sh Normal file
View file

@ -0,0 +1,19 @@
#!/usr/bin/env bash
# ==============================================================================
# Community Hass.io Add-ons: Bashio
# Bashio is an bash function library for use with Hass.io add-ons.
#
# It contains a set of commonly used operations and can be used
# to be included in add-on scripts to reduce code duplication across add-ons.
# ==============================================================================
# ------------------------------------------------------------------------------
# Checks if we are currently running in debug mode, based on the log module.
# ------------------------------------------------------------------------------
bashio::debug() {
if [[ "${__BASHIO_LOG_LEVEL}" -lt "${__BASHIO_LOG_LEVEL_DEBUG}" ]]; then
return "${__BASHIO_EXIT_NOK}"
fi
return "${__BASHIO_EXIT_OK}"
}