#! /usr/bin/env bash # # wmstartup service common functions # Copyright (C) 2018 salt # # Distributed under terms of the MIT license. # # Basic logging service. Do not override unless necessary function tsk_log() { if [ -z ${1+x} ]; then return 1; fi out=1 if ! [ -z ${2+x} ]; then out="$2"; fi col_reset="\e[0m" col_tskname="\e[96m" col_message="\e[39m" if ! [ "$out" -eq "1" ]; then col_message="\e[31m"; fi if [ "$out" -eq "0" ]; then out=1 col_message="\e[37m" fi dtf_log "${col_tskname}${task}${col_reset}: ${col_message}${1}${col_reset}" >&${out} }