]>
Dogcows Code - chaz/chatty/blob - extra/cometd/Meteor/Syslog.pm
2 ###############################################################################
4 # An HTTP server for the 2.0 web
5 # Copyright (c) 2006 contributing authors
10 # Convenience interface to syslog
12 ###############################################################################
14 # This program is free software; you can redistribute it and/or modify it
15 # under the terms of the GNU General Public License as published by the Free
16 # Software Foundation; either version 2 of the License, or (at your option)
19 # This program is distributed in the hope that it will be useful, but WITHOUT
20 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
24 # You should have received a copy of the GNU General Public License along
25 # with this program; if not, write to the Free Software Foundation, Inc.,
26 # 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
28 # For more information visit www.meteorserver.org
30 ###############################################################################
32 package Meteor
::Syslog
;
33 ###############################################################################
38 ###############################################################################
40 ###############################################################################
42 $Meteor::Syslog
::DEFAULT_FACILITY
='daemon';
44 $Meteor::Syslog
::_open
=0; # set to 1 by _open
46 ###############################################################################
48 ###############################################################################
51 my $debug=$::CONF
{'Debug'};
54 return if($priority eq 'debug' && !$debug);
61 my $txt=join("\t",@args);
66 my $facility=$::CONF
{'SyslogFacility'} || $Meteor::Syslog
::DEFAULT_FACILITY
;
68 if($debug || $facility eq 'none')
72 my $time = ($::CONF
{'LogTimeFormat'} eq 'unix') ? time : localtime(time);
74 print STDERR
"$time\t$priority\t";
75 print STDERR
sprintf($format,@args);
76 print STDERR
"\n" unless(substr($format,-1) eq "\n");
81 unless($Meteor::Syslog
::_open
)
83 my $facility=$::CONF
{'SyslogFacility'} || $Meteor::Syslog
::DEFAULT_FACILITY
;
84 openlog
($::PGM
,0,$facility);
85 $Meteor::Syslog
::_open
=1;
88 syslog
($priority,$format,@args);
92 local $SIG{'__DIE__'}='';
93 local $SIG{'__WARN__'}='';
95 &::syslog
('warning',$_[0]);
99 local $SIG{'__DIE__'}='';
100 local $SIG{'__WARN__'}='';
105 while((undef,undef,undef,$sub)=caller(++$i))
107 $inEval=1, last if $sub eq '(eval)';
112 &::syslog
('err',$_[0]);
113 $Meteor::Socket
::NO_WARN_ON_CLOSE
=1;
119 ############################################################################EOF
This page took 0.046159 seconds and 4 git commands to generate.