summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorYann E. MORIN" <yann.morin.1998@anciens.enib.fr>2008-05-25 22:25:50 (GMT)
committerYann E. MORIN" <yann.morin.1998@anciens.enib.fr>2008-05-25 22:25:50 (GMT)
commit91c6e16780724fc68bcb58411057ae3ad484862a (patch)
tree5fa56769849caf0bd95e2a8bc40da55aa0b6a4fb /scripts
parent3d9cc3d03658a35c9f5112d63a0b4e161d5602c5 (diff)
Add a new helper function: CT_DoExecLog.
It is similar to CT_DoLog, but instead of printing its arguments, it uses them as a command, and logs the output of that command. /trunk/scripts/functions | 8 8 0 0 ++++++++ 1 file changed, 8 insertions(+)
Diffstat (limited to 'scripts')
-rw-r--r--scripts/functions8
1 files changed, 8 insertions, 0 deletions
diff --git a/scripts/functions b/scripts/functions
index 09625ac..0e73143 100644
--- a/scripts/functions
+++ b/scripts/functions
@@ -105,6 +105,14 @@ CT_DoLog() {
return 0
}
+# Execute an action, and log its messages
+# Usage: CT_DoExecLog <level> <[VAR=val...] command [parameters...]>
+CT_DoExecLog() {
+ local level="$1"
+ shift
+ eval "$@" 2>&1 |CT_DoLog "${level}"
+}
+
# Tail message to be logged whatever happens
# Usage: CT_DoEnd <level>
CT_DoEnd()