/[soft]/drakx/trunk/perl-install/log.pm
ViewVC logotype

Contents of /drakx/trunk/perl-install/log.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 446 - (show annotations) (download)
Sun Feb 6 22:37:08 2011 UTC (13 years, 1 month ago) by dmorgan
File size: 1024 byte(s)
Import Clean perl-install
1 package log; # $Id: log.pm 215411 2007-04-25 12:26:16Z pixel $
2
3 use diagnostics;
4 use strict;
5
6 use c;
7
8 my ($LOG, $LOG2);
9
10
11 sub l {
12 if ($::testing) {
13 print STDERR @_, "\n";
14 } elsif ($::isInstall) {
15 if (!$LOG) {
16 open $LOG, '>>', '/tmp/ddebug.log';
17 open $LOG2, '>', '/dev/tty3' if !$::local_install;
18 select((select($LOG), $| = 1)[0]);
19 select((select($LOG2), $| = 1)[0]) if !$::local_install;
20 }
21 print $LOG "* ", @_, "\n";
22 print $LOG2 "* ", @_, "\n" if $LOG2;
23 } elsif ($::isStandalone) {
24 #- openlog was done in standalone.pm
25
26 c::syslog(c::LOG_WARNING(), join("", @_));
27 } else {
28 print STDERR @_, "\n";
29 }
30 }
31
32 sub openLog {
33 my ($file) = @_;
34 open $LOG, "> $file";
35 select((select($LOG), $| = 1)[0]);
36 }
37
38 sub closeLog() {
39 if ($LOG) {
40 close $LOG;
41 close $LOG2 if $LOG2;
42 } elsif ($::isStandalone) {
43 c::closelog();
44 }
45 }
46
47 sub explanations {
48 if ($::isStandalone) {
49 c::syslog(c::LOG_INFO()|c::LOG_LOCAL1(), "@_");
50 } else {
51 l(@_);
52 }
53 }
54
55 1;

  ViewVC Help
Powered by ViewVC 1.1.30