X-Git-Url: https://git.madduck.net/etc/zsh.git/blobdiff_plain/e7aef48f33e934106d1a50201d9f098f9886d7ec..f06c00f74d9c93b62669d0076812323a665729c0:/.zsh/logging?ds=inline diff --git a/.zsh/logging b/.zsh/logging index ad4c54a..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:-}" ] } -error() { - [[ -o xtrace ]] && set +x && local __XTRACE=1 - __log E "$@" - [ "${__XTRACE:-}" ] && set -x +zerror() { + setopt localoptions noxtrace + __log E "$@" } -warn() { - [[ -o xtrace ]] && set +x && local __XTRACE=1 - __log W "$@" - [ "${__XTRACE:-}" ] && set -x +zwarn() { + setopt localoptions noxtrace + __log W "$@" } -info() { - [[ -o xtrace ]] && set +x && local __XTRACE=1 - __log I "$@" - [ "${__XTRACE:-}" ] && set -x +zinfo() { + setopt localoptions noxtrace + __log I "$@" } -debug() { - [[ -o xtrace ]] && set +x && local __XTRACE=1 - __do_debug && __log D "$@" - [ "${__XTRACE:-}" ] && set -x +zdebug() { + setopt localoptions noxtrace + __do_debug && __log D "$@" } # vim:ft=zsh