| 1 | ################################################## | ||||||||||||||||||||||||||||
| 2 | package Log::Log4perl::Appender::Screen; | ||||||||||||||||||||||||||||
| 3 | ################################################## | ||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||
| 5 | 4 | our @ISA = qw(Log::Log4perl::Appender); | |||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||
| 7 | 4 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | 4 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||
| 10 | 4 | ▶ | use IO::Handle; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | ################################################## | ||||||||||||||||||||||||||||
| 13 | 6 | ▶ | sub new { | ||||||||||||||||||||||||||
|
Subroutine
new: called CC=5 SCAR=24.2
Pod
documented
| |||||||||||||||||||||||||||||
| 14 | ################################################## | ||||||||||||||||||||||||||||
| 15 | 6 | my($class, @options) = @_; | |||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||
| 17 | 6 | my $self = { | |||||||||||||||||||||||||||
| 18 | autoflush => 0, | ||||||||||||||||||||||||||||
| 19 | name => "unknown name", | ||||||||||||||||||||||||||||
| 20 | stderr => 1, | ||||||||||||||||||||||||||||
| 21 | utf8 => undef, | ||||||||||||||||||||||||||||
| 22 | @options, | ||||||||||||||||||||||||||||
| 23 | }; | ||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||
| 25 | 6 | ▶ | if( $self->{utf8} ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 26 | 0 | ▶ | if( $self->{stderr} ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 27 | 0 | binmode STDERR, ":utf8"; | |||||||||||||||||||||||||||
| 28 | } else { | ||||||||||||||||||||||||||||
| 29 | 0 | binmode STDOUT, ":utf8"; | |||||||||||||||||||||||||||
| 30 | } | ||||||||||||||||||||||||||||
| 31 | } | ||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||
| 33 | 6 | ▶ | if( $self->{autoflush} ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 34 | 0 | ▶ | if( $self->{stderr} ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 35 | 0 | STDERR->autoflush(1); | |||||||||||||||||||||||||||
| 36 | } else { | ||||||||||||||||||||||||||||
| 37 | 0 | STDOUT->autoflush(1); | |||||||||||||||||||||||||||
| 38 | } | ||||||||||||||||||||||||||||
| 39 | } | ||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||
| 41 | 6 | bless $self, $class; | |||||||||||||||||||||||||||
| 42 | } | ||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||
| 44 | ################################################## | ||||||||||||||||||||||||||||
| 45 | 0 | ▶ | sub log { | ||||||||||||||||||||||||||
|
Subroutine
log: not called CC=5 SCAR=34.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 46 | ################################################## | ||||||||||||||||||||||||||||
| 47 | 0 | my($self, %params) = @_; | |||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||
| 49 | 0 | my $fh = \*STDOUT; | |||||||||||||||||||||||||||
| 50 | 0 | ▶ | if (ref $self->{stderr}) { | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 51 | $fh = \*STDERR if $self->{stderr}{ $params{'log4p_level'} } | ||||||||||||||||||||||||||||
| 52 | 0 | ▶ | || $self->{stderr}{ lc $params{'log4p_level'} }; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$self->{"stderr"}{$params{"log4p_level"}} or $self->{"stderr"}{lc $params{"log4p_level"}}
MC/DC0%0/2
$self->{"stderr"}{$params{"log4p_level"}} or $self->{"stderr"}{lc $params{"log4p_level"}}
$self->{"stderr"}{$params{"log4p_level"}}
$self->{"stderr"}{lc $params{"log4p_level"}}
Truth table0%0/3
A or B
A= $self->{"stderr"}{$params{"log4p_level"}}B= $self->{"stderr"}{lc $params{"log4p_level"}}
| |||||||||||||||||||||||||||||
| 53 | } elsif ($self->{stderr}) { | ||||||||||||||||||||||||||||
| 54 | 0 | $fh = \*STDERR; | |||||||||||||||||||||||||||
| 55 | } | ||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||
| 57 | 0 | print $fh $params{message}; | |||||||||||||||||||||||||||
| 58 | } | ||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||
| 60 | 4 | 1; | |||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||
| 62 | __END__ | ||||||||||||||||||||||||||||