File Coverage

blib/lib/Log/Log4perl/JavaMap/ConsoleAppender.pm
Criterion Covered Total %
statement 15 19 78.9
branch 2 8 25.0
condition n/a
subroutine 4 4 100.0
pod 0 1 0.0
total 21 32 65.6


line stmt bran cond sub pod time code
1              
2             use Carp;
3 1     1   7 use strict;
  1         2  
  1         87  
4 1     1   6 use Log::Dispatch::Screen;
  1         2  
  1         23  
5 1     1   445  
  1         79665  
  1         201  
6              
7             my ($class, $appender_name, $data) = @_;
8             my $stderr;
9 1     1 0 4  
10 1         4 if (my $t = $data->{Target}{value}) {
11             if ($t eq 'System.out') {
12 1 50       9 $stderr = 0;
    0          
13 1 50       5 }elsif ($t eq 'System.err') {
    0          
14 1         2 $stderr = 1;
15             }else{
16 0         0 die "ERROR: illegal value '$t' for $data->{value}.Target' in appender $appender_name\n";
17             }
18 0         0 }elsif (defined $data->{stderr}{value}){
19             $stderr = $data->{stderr}{value};
20             }else{
21 0         0 $stderr = 0;
22             }
23 0         0  
24             return Log::Log4perl::Appender->new("Log::Dispatch::Screen",
25             name => $appender_name,
26 1         10 stderr => $stderr );
27             }
28              
29              
30             1;
31              
32              
33             =encoding utf8
34              
35             =head1 NAME
36              
37             Log::Log4perl::JavaMap::ConsoleAppender - wraps Log::Dispatch::Screen
38              
39             =head1 SYNOPSIS
40              
41              
42             =head1 DESCRIPTION
43              
44             Possible config properties for log4j ConsoleAppender are
45              
46             Target (System.out, System.err, default is System.out)
47              
48             Possible config properties for Log::Dispatch::Screen are
49              
50             stderr (0 or 1)
51              
52             =head1 SEE ALSO
53              
54             http://jakarta.apache.org/log4j/docs/
55              
56             Log::Log4perl::Javamap
57              
58             Log::Dispatch::Screen
59              
60             =cut
61              
62             =head1 LICENSE
63              
64             Copyright 2002-2013 by Mike Schilli E<lt>m@perlmeister.comE<gt>
65             and Kevin Goess E<lt>cpan@goess.orgE<gt>.
66              
67             This library is free software; you can redistribute it and/or modify
68             it under the same terms as Perl itself.
69              
70             =head1 AUTHOR
71              
72             Please contribute patches to the project on Github:
73              
74             http://github.com/mschilli/log4perl
75              
76             Send bug reports or requests for enhancements to the authors via our
77              
78             MAILING LIST (questions, bug reports, suggestions/patches):
79             log4perl-devel@lists.sourceforge.net
80              
81             Authors (please contact them via the list above, not directly):
82             Mike Schilli <m@perlmeister.com>,
83             Kevin Goess <cpan@goess.org>
84              
85             Contributors (in alphabetical order):
86             Ateeq Altaf, Cory Bennett, Jens Berthold, Jeremy Bopp, Hutton
87             Davidson, Chris R. Donnelly, Matisse Enzer, Hugh Esco, Anthony
88             Foiani, James FitzGibbon, Carl Franks, Dennis Gregorovic, Andy
89             Grundman, Paul Harrington, Alexander Hartmaier David Hull,
90             Robert Jacobson, Jason Kohles, Jeff Macdonald, Markus Peter,
91             Brett Rann, Peter Rabbitson, Erik Selberg, Aaron Straup Cope,
92             Lars Thegler, David Viner, Mac Yang.
93