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.pm56
1 files changed, 41 insertions, 15 deletions
diff --git a/perl-install/log.pm b/perl-install/log.pm
index 0fe696f07..b049f5d49 100644
--- a/perl-install/log.pm
+++ b/perl-install/log.pm
@@ -1,34 +1,60 @@
+package log; # $Id$
+
use diagnostics;
use strict;
+use c;
-package log;
+#-#####################################################################################
+#- Globals
+#-#####################################################################################
my $logOpen = 0;
my $logDebugMessages = 0;
-1;
-sub fd() { fileno LOG }
+#-######################################################################################
+#- Functions
+#-######################################################################################
+sub F() { *LOG }
-sub l {
+sub l {
$logOpen or openLog();
- print LOG "* ", @_, "\n";
- print LOG2 "* ", @_, "\n";
+ if ($::isStandalone) {
+ c::syslog(join "", @_);
+ } elsif ($::isInstall) {
+ print LOG "* ", @_, "\n";
+ print LOG2 "* ", @_, "\n";
+ } else {
+ print STDERR @_, "\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]);
+ if ($::isStandalone) {
+ c::openlog("DrakX");
+ } elsif ($::isInstall) {
+ 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; }
+sub closeLog() {
+ if ($::isStandalone) {
+ c::closelog();
+ } else { close LOG; close LOG2; }
+}
+
+#-######################################################################################
+#- Wonderful perl :(
+#-######################################################################################
+1;