summaryrefslogtreecommitdiffstats
path: root/perl-install/log.pm
diff options
context:
space:
mode:
Diffstat (limited to 'perl-install/log.pm')
-rw-r--r--perl-install/log.pm65
1 files changed, 30 insertions, 35 deletions
diff --git a/perl-install/log.pm b/perl-install/log.pm
index 3f281b5c6..a0f7bd41d 100644
--- a/perl-install/log.pm
+++ b/perl-install/log.pm
@@ -1,60 +1,55 @@
-package log; # $Id$
+package log;
use diagnostics;
use strict;
-use vars qw(*LOG *LOG2);
use c;
+my ($LOG, $LOG2);
-#-#####################################################################################
-#- Globals
-#-#####################################################################################
-my $logOpen = 0;
-my $logDebugMessages = 0;
-
-#-######################################################################################
-#- Functions
-#-######################################################################################
-sub F() { *LOG }
sub l {
- $logOpen or openLog();
if ($::testing) {
print STDERR @_, "\n";
+ } 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("", @_));
- } 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"; #-#
- select((select(LOG), $| = 1)[0]);
- select((select(LOG2), $| = 1)[0]);
- }
- exists $ENV{DEBUG} and $logDebugMessages = 1;
- $logOpen = 1;
+
+sub openLog {
+ my ($file) = @_;
+ open $LOG, "> $file";
+ select((select($LOG), $| = 1)[0]);
}
sub closeLog() {
- if ($::isStandalone) {
+ if ($LOG) {
+ close $LOG;
+ close $LOG2 if $LOG2;
+ } elsif ($::isStandalone) {
c::closelog();
- } else { close LOG; close LOG2 }
+ }
}
-sub explanations { c::syslog(c::LOG_INFO()|c::LOG_LOCAL1(), "@_") }
+sub explanations {
+ if ($::isStandalone) {
+ c::syslog(c::LOG_INFO()|c::LOG_LOCAL1(), "@_");
+ } else {
+ l(@_);
+ }
+}
1;