Filter/Logger/Syslog.pm untested

filter: Statementstmt 0.0% 0 / 18 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 6 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 25 CC 1 SCAR 6.9
CC
1
Cov
0%
new
2.0
BEGIN
2.0
BEGIN
2.0
CRAP 2.0
1 #
2 # Courier::Filter::Logger::Syslog class
3 #
4 # (C) 2004-2008 Julian Mehnle <julian@mehnle.net>
5 # $Id: Syslog.pm 210 2008-03-21 19:30:31Z julian $
6 #
7 ###############################################################################
8  
9 =head1 NAME
10  
11 Courier::Filter::Logger::Syslog - Syslog logger for the Courier::Filter
12 framework
13  
14 =cut
15  
16 package Courier::Filter::Logger::Syslog;
17  
18 =head1 SYNOPSIS
19  
20 use Courier::Filter::Logger::Syslog;
21  
22 my $logger = Courier::Filter::Logger::Syslog->new();
23  
24 # For use in an individual filter module:
25 my $module = Courier::Filter::Module::My->new(
26 ...
27 logger => $logger,
28 ...
29 );
30  
31 # For use as a global Courier::Filter logger object:
32 my $filter = Courier::Filter->new(
33 ...
34 logger => $logger,
35 ...
36 );
37  
38 =cut
39  
40 use warnings;
41 use strict;
42  
43 use base 'Courier::Filter::Logger::IOHandle';
44  
45 use constant TRUE => (0 == 0);
46 use constant FALSE => not TRUE;
47  
48 =head1 DESCRIPTION
49  
50 This class is a syslog logger class for use with Courier::Filter and its filter
51 modules. It is derived from B<Courier::Filter::Logger::IOHandle>.
52  
53 =cut
54  
55 # Implementation:
56 ###############################################################################
57  
58 =head2 Constructor
59  
60 The following constructor is provided:
61  
62 =over
63  
64 =item B<new>: returns I<Courier::Filter::Logger::Syslog>; throws
65 I<Courier::Error>
66  
67 Creates a new logger that logs messages to syslog.
68  
69 =cut
70  
71 sub new {
72 my ($class, %options) = @_;
73
74 return $class->SUPER::new(
75 %options,
76 timestamp => FALSE,
77 handle => \*STDERR
78 );
79 }
80  
81 =back
82  
83 =head2 Instance methods
84  
85 The following instance methods are provided, as inherited from
86 B<Courier::Filter::Logger::IOHandle>:
87  
88 =over
89  
90 =item B<log_error($text)>: throws Perl exceptions
91  
92 Logs the error message given as C<$text> (a string which may contain newlines).
93  
94 =item B<log_rejected_message($message, $reason)>: throws Perl exceptions
95  
96 Logs the B<Courier::Message> given as C<$message> as having been rejected due
97 to C<$reason> (a string which may contain newlines).
98  
99 =back
100  
101 =head1 SEE ALSO
102  
103 L<Courier::Filter::Logger::IOHandle>, L<Courier::Filter::Logger>,
104 L<Courier::Filter::Overview>.
105  
106 For AVAILABILITY, SUPPORT, and LICENSE information, see
107 L<Courier::Filter::Overview>.
108  
109 =head1 AUTHOR
110  
111 Julian Mehnle <julian@mehnle.net>
112  
113 =cut
114  
115 TRUE;