summaryrefslogtreecommitdiffstats
path: root/perl-install/log.pm
diff options
context:
space:
mode:
authorAntoine Ginies <aginies@mandriva.com>2011-01-19 10:44:49 +0000
committerAntoine Ginies <aginies@mandriva.com>2011-01-19 10:44:49 +0000
commit530a16ec071db0e24e6e949e265a96848864967c (patch)
treefe40cacd28d67b98186754c551b7fd339ebc7e17 /perl-install/log.pm
downloaddrakx-backup-do-not-use-530a16ec071db0e24e6e949e265a96848864967c.tar
drakx-backup-do-not-use-530a16ec071db0e24e6e949e265a96848864967c.tar.gz
drakx-backup-do-not-use-530a16ec071db0e24e6e949e265a96848864967c.tar.bz2
drakx-backup-do-not-use-530a16ec071db0e24e6e949e265a96848864967c.tar.xz
drakx-backup-do-not-use-530a16ec071db0e24e6e949e265a96848864967c.zip
add mes5-2.6.33 branch
Diffstat (limited to 'perl-install/log.pm')
-rw-r--r--perl-install/log.pm55
1 files changed, 55 insertions, 0 deletions
diff --git a/perl-install/log.pm b/perl-install/log.pm
new file mode 100644
index 000000000..440e9737d
--- /dev/null
+++ b/perl-install/log.pm
@@ -0,0 +1,55 @@
+package log; # $Id: log.pm 215411 2007-04-25 12:26:16Z pixel $
+
+use diagnostics;
+use strict;
+
+use c;
+
+my ($LOG, $LOG2);
+
+
+sub l {
+ 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("", @_));
+ } else {
+ print STDERR @_, "\n";
+ }
+}
+
+sub openLog {
+ my ($file) = @_;
+ open $LOG, "> $file";
+ select((select($LOG), $| = 1)[0]);
+}
+
+sub closeLog() {
+ if ($LOG) {
+ close $LOG;
+ close $LOG2 if $LOG2;
+ } elsif ($::isStandalone) {
+ c::closelog();
+ }
+}
+
+sub explanations {
+ if ($::isStandalone) {
+ c::syslog(c::LOG_INFO()|c::LOG_LOCAL1(), "@_");
+ } else {
+ l(@_);
+ }
+}
+
+1;