summaryrefslogtreecommitdiffstats
path: root/perl-install/log.pm
diff options
context:
space:
mode:
authorChmouel Boudjnah <chmouel@mandriva.org>1999-07-01 12:29:54 +0000
committerChmouel Boudjnah <chmouel@mandriva.org>1999-07-01 12:29:54 +0000
commite1729dfdb9c341fe0b9fed7d7b0a80691a547d82 (patch)
treeb72fd8f59af166fe944ebcf114d648ed5644f752 /perl-install/log.pm
parentb50e655e352e2524fb3fb84b2bb4bc96e6a04cf0 (diff)
downloaddrakx-backup-do-not-use-e1729dfdb9c341fe0b9fed7d7b0a80691a547d82.tar
drakx-backup-do-not-use-e1729dfdb9c341fe0b9fed7d7b0a80691a547d82.tar.gz
drakx-backup-do-not-use-e1729dfdb9c341fe0b9fed7d7b0a80691a547d82.tar.bz2
drakx-backup-do-not-use-e1729dfdb9c341fe0b9fed7d7b0a80691a547d82.tar.xz
drakx-backup-do-not-use-e1729dfdb9c341fe0b9fed7d7b0a80691a547d82.zip
"See_The_Changelog"
Diffstat (limited to 'perl-install/log.pm')
-rw-r--r--perl-install/log.pm34
1 files changed, 34 insertions, 0 deletions
diff --git a/perl-install/log.pm b/perl-install/log.pm
new file mode 100644
index 000000000..0fe696f07
--- /dev/null
+++ b/perl-install/log.pm
@@ -0,0 +1,34 @@
+use diagnostics;
+use strict;
+
+package log;
+
+my $logOpen = 0;
+my $logDebugMessages = 0;
+
+1;
+
+sub fd() { fileno LOG }
+
+sub l {
+ $logOpen or openLog();
+ print LOG "* ", @_, "\n";
+ print LOG2 "* ", @_, "\n";
+}
+sub ld { $logDebugMessages and &l }
+sub w { &l }
+
+sub openLog(;$) {
+ if ($_[0]) { # useLocal
+ open LOG, "> $_[0]" or die "no log possible :(";
+ } else {
+ open LOG, "> /dev/tty3" or open LOG, ">> /tmp/install.log" or die "no log possible :(";
+ }
+ open LOG2, ">> /tmp/ddebug.log" or die "no log possible :(";
+ select((select(LOG), $| = 1)[0]);
+ select((select(LOG2), $| = 1)[0]);
+ exists $ENV{DEBUG} and $logDebugMessages = 1;
+ $logOpen = 1;
+}
+
+sub closeLog() { close LOG; close LOG2; }