summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2005-04-13 15:28:42 +0000
committerPascal Rigaux <pixel@mandriva.com>2005-04-13 15:28:42 +0000
commit0488889bd22528ced2529489ab1bbd8635e25227 (patch)
treee020016ebe89f6959b82428acba2f8ed21891ffb
parentcf5dce530e20a282bfd11ae5aacfc28045c86cac (diff)
downloaddrakx-backup-do-not-use-0488889bd22528ced2529489ab1bbd8635e25227.tar
drakx-backup-do-not-use-0488889bd22528ced2529489ab1bbd8635e25227.tar.gz
drakx-backup-do-not-use-0488889bd22528ced2529489ab1bbd8635e25227.tar.bz2
drakx-backup-do-not-use-0488889bd22528ced2529489ab1bbd8635e25227.tar.xz
drakx-backup-do-not-use-0488889bd22528ced2529489ab1bbd8635e25227.zip
cleanup and allow openLog() to force the log file
-rw-r--r--perl-install/log.pm35
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 {