diff options
Diffstat (limited to 'perl-install/log.pm')
-rw-r--r-- | perl-install/log.pm | 34 |
1 files changed, 13 insertions, 21 deletions
diff --git a/perl-install/log.pm b/perl-install/log.pm index da3c56037..365aa323c 100644 --- a/perl-install/log.pm +++ b/perl-install/log.pm @@ -7,23 +7,22 @@ use c; my ($LOG, $LOG2); -#-##################################################################################### -#- Globals -#-##################################################################################### - -#-###################################################################################### -#- Functions -#-###################################################################################### -sub F() { $LOG } sub l { - $LOG or openLog(); if ($::testing) { print STDERR @_, "\n"; - } elsif ($LOG) { + } elsif ($::isInstall) { + if (!$LOG) { + open $LOG, '>>', '/tmp/ddebug.log'; + open $LOG2, '>', '/dev/tty3' if !$::local_install; + select((select($LOG), $| = 1)[0]); + select((select($LOG2), $| = 1)[0]) if !$::local_install; + } print $LOG "* ", @_, "\n"; print $LOG2 "* ", @_, "\n" if $LOG2; } elsif ($::isStandalone) { + #- openlog was done in standalone.pm + c::syslog(c::LOG_WARNING(), join("", @_)); } else { print STDERR @_, "\n"; @@ -31,22 +30,15 @@ sub l { } sub openLog { - my ($o_file) = @_; - - if ($o_file) { #- useLocal - open $LOG, "> $o_file"; - } elsif ($::isInstall) { - open $LOG, "> /dev/tty3"; - open $LOG2, ">> /tmp/ddebug.log"; - } - select((select($LOG), $| = 1)[0]) if $LOG; - select((select($LOG2), $| = 1)[0]) if $LOG2; + my ($file) = @_; + open $LOG, "> $file"; + select((select($LOG), $| = 1)[0]); } sub closeLog() { if ($LOG) { close $LOG; - close $LOG2; + close $LOG2 if $LOG2; } elsif ($::isStandalone) { c::closelog(); } |