# logging # # Logging abilities for the shell initialisation scripts # # Copyright © 1994–2017 martin f. krafft # Released under the terms of the Artistic Licence 2.0 # # Source repository: http://git.madduck.net/v/etc/zsh.git # __log() { setopt localoptions noxtrace local level; level="$1"; shift echo "${level}: $@" >&2 } __do_debug() { setopt localoptions noxtrace [ -n "${ZDEBUG:-}" ] } zerror() { setopt localoptions noxtrace __log E "$@" } zwarn() { setopt localoptions noxtrace __log W "$@" } zinfo() { setopt localoptions noxtrace __log I "$@" } zdebug() { setopt localoptions noxtrace __do_debug && __log D "$@" } # vim:ft=zsh