X-Git-Url: https://git.madduck.net/etc/zsh.git/blobdiff_plain/fee44c904d0fe9a9809c347b0de86a1a20c61786..dce22ed214c45f63c9358cb9d5a562e49dfdf7c7:/.zsh/logging?ds=inline diff --git a/.zsh/logging b/.zsh/logging index 26d7544..c23ad42 100644 --- a/.zsh/logging +++ b/.zsh/logging @@ -2,38 +2,36 @@ # # Logging abilities for the shell initialisation scripts # -# Copyright © 1994–2008 martin f. krafft +# Copyright © 1994–2017 martin f. krafft # Released under the terms of the Artistic Licence 2.0 # -# Source repository: git://git.madduck.net/etc/zsh.git +# 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() { - [[ -o xtrace ]] && set +x && local __XTRACE=1 + setopt localoptions noxtrace __log E "$@" - [ "${__XTRACE:-}" ] && set -x } zwarn() { - [[ -o xtrace ]] && set +x && local __XTRACE=1 + setopt localoptions noxtrace __log W "$@" - [ "${__XTRACE:-}" ] && set -x } zinfo() { - [[ -o xtrace ]] && set +x && local __XTRACE=1 + setopt localoptions noxtrace __log I "$@" - [ "${__XTRACE:-}" ] && set -x } zdebug() { - [[ -o xtrace ]] && set +x && local __XTRACE=1 + setopt localoptions noxtrace __do_debug && __log D "$@" - [ "${__XTRACE:-}" ] && set -x } # vim:ft=zsh