From 01c49dcea67e98b14a5e7de5b239a920e93fdc36 Mon Sep 17 00:00:00 2001 From: Franck Nijhof Date: Fri, 15 Mar 2019 20:43:16 +0100 Subject: [PATCH] :hammer: Redirect all output from Bashio to stderr --- lib/color.sh | 36 ++++++++++++++++++------------------ lib/log.sh | 20 ++++++++++---------- 2 files changed, 28 insertions(+), 28 deletions(-) diff --git a/lib/color.sh b/lib/color.sh index 3c4d391..51ba778 100644 --- a/lib/color.sh +++ b/lib/color.sh @@ -11,124 +11,124 @@ # Reset color output (background and foreground colors). # ------------------------------------------------------------------------------ function bashio::color.reset() { - echo -n -e "${__BASHIO_COLORS_RESET}" + printf "${__BASHIO_COLORS_RESET}" >&2 } # ------------------------------------------------------------------------------ # Set default output color. # ------------------------------------------------------------------------------ function bashio::color.default() { - echo -n -e "${__BASHIO_COLORS_DEFAULT}" + printf "${__BASHIO_COLORS_DEFAULT}" >&2 } # ------------------------------------------------------------------------------ # Set font output color to black. # ------------------------------------------------------------------------------ function bashio::color.black() { - echo -n -e "${__BASHIO_COLORS_BLACK}" + printf "${__BASHIO_COLORS_BLACK}" >&2 } # ------------------------------------------------------------------------------ # Set font output color to red. # ------------------------------------------------------------------------------ function bashio::color.red() { - echo -n -e "${__BASHIO_COLORS_RED}" + printf "${__BASHIO_COLORS_RED}" >&2 } # ------------------------------------------------------------------------------ # Set font output color to green. # ------------------------------------------------------------------------------ function bashio::color.green() { - echo -n -e "${__BASHIO_COLORS_GREEN}" + printf "${__BASHIO_COLORS_GREEN}" >&2 } # ------------------------------------------------------------------------------ # Set font output color to yellow. # ------------------------------------------------------------------------------ function bashio::color.yellow() { - echo -n -e "${__BASHIO_COLORS_YELLOW}" + printf "${__BASHIO_COLORS_YELLOW}" >&2 } # ------------------------------------------------------------------------------ # Set font output color to blue. # ------------------------------------------------------------------------------ function bashio::color.blue() { - echo -n -e "${__BASHIO_COLORS_BLUE}" + printf "${__BASHIO_COLORS_BLUE}" >&2 } # ------------------------------------------------------------------------------ # Set font output color to magenta. # ------------------------------------------------------------------------------ function bashio::color.magenta() { - echo -n -e "${__BASHIO_COLORS_MAGENTA}" + printf "${__BASHIO_COLORS_MAGENTA}" >&2 } # ------------------------------------------------------------------------------ # Set font output color to cyan. # ------------------------------------------------------------------------------ function bashio::color.cyan() { - echo -n -e "${__BASHIO_COLORS_CYAN}" + printf "${__BASHIO_COLORS_CYAN}" >&2 } # ------------------------------------------------------------------------------ # Set font output color background to default. # ------------------------------------------------------------------------------ function bashio::color.bg.default() { - echo -n -e "${__BASHIO_COLORS_BG_DEFAULT}" + printf "${__BASHIO_COLORS_BG_DEFAULT}" >&2 } # ------------------------------------------------------------------------------ # Set font output color background to black. # ------------------------------------------------------------------------------ function bashio::color.bg.black() { - echo -n -e "${__BASHIO_COLORS_BG_BLACK}" + printf "${__BASHIO_COLORS_BG_BLACK}" >&2 } # ------------------------------------------------------------------------------ # Set font output color background to red. # ------------------------------------------------------------------------------ function bashio::color.bg.red() { - echo -n -e "${__BASHIO_COLORS_BG_RED}" + printf "${__BASHIO_COLORS_BG_RED}" >&2 } # ------------------------------------------------------------------------------ # Set font output color background to green. # ------------------------------------------------------------------------------ function bashio::color.bg.green() { - echo -n -e "${__BASHIO_COLORS_BG_GREEN}" + printf "${__BASHIO_COLORS_BG_GREEN}" >&2 } # ------------------------------------------------------------------------------ # Set font output color background to yellow. # ------------------------------------------------------------------------------ function bashio::color.bg.yellow() { - echo -n -e "${__BASHIO_COLORS_BG_YELLOW}" + printf "${__BASHIO_COLORS_BG_YELLOW}" >&2 } # ------------------------------------------------------------------------------ # Set font output color background to blue. # ------------------------------------------------------------------------------ function bashio::color.bg.blue() { - echo -n -e "${__BASHIO_COLORS_BG_BLUE}" + printf "${__BASHIO_COLORS_BG_BLUE}" >&2 } # ------------------------------------------------------------------------------ # Set font output color background to magenta. # ------------------------------------------------------------------------------ function bashio::color.bg.magenta() { - echo -n -e "${__BASHIO_COLORS_BG_MAGENTA}" + printf "${__BASHIO_COLORS_BG_MAGENTA}" >&2 } # ------------------------------------------------------------------------------ # Set font output color background to cyan. # ------------------------------------------------------------------------------ function bashio::color.bg.cyan() { - echo -n -e "${__BASHIO_COLORS_BG_CYAN}" + printf "${__BASHIO_COLORS_BG_CYAN}" >&2 } # ------------------------------------------------------------------------------ # Set font output color background to white. # ------------------------------------------------------------------------------ function bashio::color.bg.white() { - echo -n -e "${__BASHIO_COLORS_BG_WHITE}" + printf "${__BASHIO_COLORS_BG_WHITE}" >&2 } diff --git a/lib/log.sh b/lib/log.sh index 301283d..3a8c41f 100644 --- a/lib/log.sh +++ b/lib/log.sh @@ -78,9 +78,9 @@ function bashio::log.debug() { # ------------------------------------------------------------------------------ function bashio::log.info() { local message=$* - bashio::color.cyan >&2 + bashio::color.cyan bashio::log.log "${__BASHIO_LOG_LEVEL_INFO}" "${message}" - bashio::color.reset >&2 + bashio::color.reset } # ------------------------------------------------------------------------------ @@ -91,9 +91,9 @@ function bashio::log.info() { # ------------------------------------------------------------------------------ function bashio::log.notice() { local message=$* - bashio::color.blue >&2 + bashio::color.blue bashio::log.log "${__BASHIO_LOG_LEVEL_NOTICE}" "${message}" - bashio::color.reset >&2 + bashio::color.reset } # ------------------------------------------------------------------------------ @@ -104,9 +104,9 @@ function bashio::log.notice() { # ------------------------------------------------------------------------------ function bashio::log.warning() { local message=$* - bashio::color.yellow >&2 + bashio::color.yellow bashio::log.log "${__BASHIO_LOG_LEVEL_WARNING}" "${message}" - bashio::color.reset >&2 + bashio::color.reset } # ------------------------------------------------------------------------------ @@ -117,9 +117,9 @@ function bashio::log.warning() { # ------------------------------------------------------------------------------ function bashio::log.error() { local message=$* - bashio::color.magenta >&2 + bashio::color.magenta bashio::log.log "${__BASHIO_LOG_LEVEL_ERROR}" "${message}" - bashio::color.reset >&2 + bashio::color.reset } # ------------------------------------------------------------------------------ @@ -130,7 +130,7 @@ function bashio::log.error() { # ------------------------------------------------------------------------------ function bashio::log.fatal() { local message=$* - bashio::color.red >&2 + bashio::color.red bashio::log.log "${__BASHIO_LOG_LEVEL_FATAL}" "${message}" - bashio::color.reset >&2 + bashio::color.reset }