diff options
Diffstat (limited to 'perl-install')
-rw-r--r-- | perl-install/log.pm | 35 |
1 files changed, 15 insertions, 20 deletions
diff --git a/perl-install/log.pm b/perl-install/log.pm index 3e8826963..2eaecb395 100644 --- a/perl-install/log.pm +++ b/perl-install/log.pm @@ -10,8 +10,6 @@ my ($LOG, $LOG2); #-##################################################################################### #- Globals #-##################################################################################### -my $logOpen = 0; -my $logDebugMessages = 0; #-###################################################################################### #- Functions @@ -19,40 +17,37 @@ my $logDebugMessages = 0; sub F() { $LOG } sub l { - $logOpen or openLog(); + $LOG or openLog(); if ($::testing) { print STDERR @_, "\n"; + } elsif ($LOG) { + print $LOG "* ", @_, "\n"; + print $LOG2 "* ", @_, "\n" if $LOG2; } elsif ($::isStandalone) { c::syslog(c::LOG_WARNING(), join("", @_)); - } elsif ($::isInstall) { - print $LOG "* ", @_, "\n"; - print $LOG2 "* ", @_, "\n"; } else { print STDERR @_, "\n"; } } -sub ld { $logDebugMessages and &l } -sub w { &l } -sub openLog(;$) { - if ($::isInstall) { - if ($_[0]) { #- useLocal - open $LOG, "> $_[0]"; #-# - } else { - open $LOG, "> /dev/tty3"; #-# - } - open $LOG2, ">> /tmp/ddebug.log"; #-# +sub openLog { + if ($_[0]) { #- useLocal + open $LOG, "> $_[0]"; + } elsif ($::isInstall) { + open $LOG, "> /dev/tty3"; + open $LOG2, ">> /tmp/ddebug.log"; select((select($LOG), $| = 1)[0]); select((select($LOG2), $| = 1)[0]); } - exists $ENV{DEBUG} and $logDebugMessages = 1; - $logOpen = 1; } sub closeLog() { - if ($::isStandalone) { + if ($LOG) { + close $LOG; + close $LOG2; + } elsif ($::isStandalone) { c::closelog(); - } else { close $LOG; close $LOG2 } + } } sub explanations { |