Log4perl/JavaMap/SyslogAppender.pm

filter: Statementstmt 81.8% 18 / 22 Branchbran 37.5% 3 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 4 / 4 Podpod 0.0% 0 / 1 totaltotal 71.4% 25 / 35 CC 5 SCAR 15.9
CC
5
Cov
70%
new
7.3
BEGIN
1.0
BEGIN
1.0
CRAP 4.9
« Log4perl/Catalyst.pm ↑ Summary Log4perl/InternalDebug.pm »
1 package Log::Log4perl::JavaMap::SyslogAppender;
2  
3 1 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use Log::Dispatch::Syslog;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7  
8 1 ▶sub new {
Subroutine new: called CC=5 SCAR=19.8
Pod undocumented
9 1 my ($class, $appender_name, $data) = @_;
10 1 my $stderr;
11  
12 1 my ($ident, #defaults to $0
13 $logopt, #Valid options are 'cons', 'pid', 'ndelay', and 'nowait'.
14 $facility, #Valid options are 'auth', 'authpriv',
15 # 'cron', 'daemon', 'kern', 'local0' through 'local7',
16 # 'mail, 'news', 'syslog', 'user', 'uucp'. Defaults to
17 # 'user'
18 $socket, #Valid options are 'unix' or 'inet'. Defaults to 'inet'
19 );
20  
21 1 ▶ if (defined $data->{Facility}{value}) {
Branch: 2 branches
BranchTrueFalseTotal
if (defined $data->{'Facility'}{'value'}) { } 1 0 1
elsif (defined $data->{'facility'}{'value'}) { } 0 0 0
22 $facility = $data->{Facility}{value}
23 1 }elsif (defined $data->{facility}{value}){
24 0 $facility = $data->{facility}{value};
25 }else{
26 0 $facility = 'user';
27 }
28  
29 1 ▶ if (defined $data->{Ident}{value}) {
Branch: 2 branches
BranchTrueFalseTotal
if (defined $data->{'Ident'}{'value'}) { } 0 1 1
elsif (defined $data->{'ident'}{'value'}) { } 0 1 1
30 $ident = $data->{Ident}{value}
31 0 }elsif (defined $data->{ident}{value}){
32 0 $ident = $data->{ident}{value};
33 }else{
34 1 $ident = $0;
35 }
36
37 1 return Log::Log4perl::Appender->new("Log::Dispatch::Syslog",
38 name => $appender_name,
39 facility => $facility,
40 ident => $ident,
41 min_level => 'debug',
42 );
43 }
44  
45 1 1;
46  
47 =encoding utf8
48  
49 =head1 NAME
50  
51 Log::Log4perl::JavaMap::SysLogAppender - wraps Log::Dispatch::Syslog
52  
53 =head1 DESCRIPTION
54  
55 This maps log4j's SyslogAppender to Log::Dispatch::Syslog
56  
57 Possible config properties for log4j SyslogAppender are
58  
59 SyslogHost (Log::Dispatch::Syslog only accepts 'localhost')
60 Facility
61  
62 Possible config properties for Log::Dispatch::Syslog are
63  
64 min_level (debug)
65 max_level
66 ident (defaults to $0)
67 logopt
68 facility
69 socket (defaults to 'inet')
70  
71 =head1 SEE ALSO
72  
73 http://jakarta.apache.org/log4j/docs/
74  
75 Log::Log4perl::Javamap
76  
77 =head1 LICENSE
78  
79 Copyright 2002-2026 by Mike Schilli E<lt>m@perlmeister.comE<gt>
80 and Kevin Goess E<lt>cpan@goess.orgE<gt>.
81  
82 This library is free software; you can redistribute it and/or modify
83 it under the same terms as Perl itself.
« Log4perl/Catalyst.pm ↑ Summary Log4perl/InternalDebug.pm »