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.pm63
1 files changed, 29 insertions, 34 deletions
diff --git a/perl-install/log.pm b/perl-install/log.pm
index e14454b03..a0f7bd41d 100644
--- a/perl-install/log.pm
+++ b/perl-install/log.pm
@@ -1,4 +1,4 @@
-package log; # $Id$
+package log;
use diagnostics;
use strict;
@@ -7,54 +7,49 @@ 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 ($::isStandalone) {
- c::syslog(c::LOG_WARNING(), join("", @_));
} 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";
+ print $LOG2 "* ", @_, "\n" if $LOG2;
+ } elsif ($::isStandalone) {
+ #- openlog was done in standalone.pm
+
+ c::syslog(c::LOG_WARNING(), join("", @_));
} 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;