summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDieter Plaetinck <dieter@plaetinck.be>2009-03-08 18:44:32 +0100
committerDieter Plaetinck <dieter@plaetinck.be>2009-03-08 18:44:32 +0100
commit177d1a660bbdd3f46e82bc888adc84cc785509a5 (patch)
tree496fddf514ec12ef9e6da5b2691e25df7be7a574 /src
parent4dd67fa4ffb704f695ace2b62f3a54ccf1d43ee9 (diff)
support multiple debug categories
Diffstat (limited to 'src')
-rw-r--r--src/core/libs/lib-ui.sh10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/core/libs/lib-ui.sh b/src/core/libs/lib-ui.sh
index fcb5c83..df48715 100644
--- a/src/core/libs/lib-ui.sh
+++ b/src/core/libs/lib-ui.sh
@@ -105,11 +105,17 @@ log ()
}
-# $1 = category. one of MAIN, PROCEDURE, UI, UI-INTERACTIVE, FS, MISC, NETWORK, PACMAN, SOFTWARE
+# $1 = one or more categories (separated by spaces) from: MAIN, PROCEDURE, UI, UI-INTERACTIVE, FS, MISC, NETWORK, PACMAN, SOFTWARE
+# You should always at least specify where you are (main, procedure or the name of the lib) and optionally further specification: eg in a ui function that works with pacman.
+# This is very useful in ui-interactive where we always work with something else.
# $2 = string to log
debug ()
{
- [ "$1" == 'MAIN' -o "$1" == 'PROCEDURE' -o "$1" == 'UI' -o "$1" == 'UI-INTERACTIVE' -o "$1" == 'FS' -o "$1" == 'MISC' -o "$1" == 'NETWORK' -o "$1" == 'PACMAN' -o "$1" == 'SOFTWARE' ] || die_error "debug \$1 ($1) is not a valid debug category"
+ valid_cats=(MAIN PROCEDURE UI UI-INTERACTIVE FS MISC NETWORK PACMAN SOFTWARE)
+ for cat in $1
+ do
+ check_is_in $cat "${valid_cats[@]}" || die_error "debug \$1 contains a value ($cat) which is not a valid debug category"
+ done
[ -n "$2" ] || die_error "debug \$2 cannot be empty"
mkdir -p $LOG_DIR || die_error "Cannot create log directory"