From 34d6fe7f18772f5465bbef9329ab1ae332bd01c4 Mon Sep 17 00:00:00 2001 From: Dieter Plaetinck Date: Thu, 13 Nov 2008 14:08:51 +0100 Subject: also log/debuglog to a file --- src/fifa.sh | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/fifa.sh b/src/fifa.sh index 0dc3900..aab895a 100755 --- a/src/fifa.sh +++ b/src/fifa.sh @@ -3,7 +3,7 @@ ###### Set some default variables or get them from the setup script ###### TITLE="Flexible Installer Framework for Arch linux" LOG="/dev/tty7" - +LOGFILE=/home/arch/fifa/runtime/fifa.log #TODO: maybe we could use a flag to en/disable logging to a file. ###### Miscalleaneous functions ###### @@ -32,15 +32,22 @@ notify () log () { - echo -e "[LOG] `date +"%Y-%m-%d %H:%M:%S"` $@" - echo -e "[LOG] `date +"%Y-%m-%d %H:%M:%S"` $@" >$LOG + str="[LOG] `date +"%Y-%m-%d %H:%M:%S"` $@" + echo -e "$str" + echo -e "$str" > $LOG + echo -e "$str" > $LOGFILE } debug () { - [ "$DEBUG" = "1" ] && echo -e "[DEBUG] $@" - [ "$DEBUG" = "1" ] && echo -e "[DEBUG] $@" >$LOG + str="[DEBUG] $@" + if [ "$DEBUG" = "1" ] + then + echo -e "$str" + echo -e "$str" > $LOG + echo -e "$str" > $LOGFILE + fi } -- cgit v1.2.3-54-g00ecf