Log4perl/Filter/MDC.pm

filter: Statementstmt 100% 24 / 24 Branchbran 100% 2 / 2 Conditioncond 66.6% 2 / 3 MC/DCmcdc 50.0% 1 / 2 Subroutinesub 100% 6 / 6 Podpod 0.0% 0 / 2 totaltotal 89.7% 35 / 39 CC 3 SCAR 5.6
CC
3
Cov
97%
ok
3.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.8
« Log4perl/Util/TimeTracker.pm ↑ Summary Log4perl/Layout/NoopLayout.pm »
1 package Log::Log4perl::Filter::MDC;
2 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 1 ▶use Log::Log4perl::Util qw( params_check );
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 1 ▶use base "Log::Log4perl::Filter";
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 1 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
Pod undocumented
10 1 my ( $class, %options ) = @_;
11  
12 1 my $self = {%options};
13  
14 1 params_check( $self, [qw( KeyToMatch RegexToMatch )] );
15  
16 1 $self->{RegexToMatch} = qr/$self->{RegexToMatch}/;
17  
18 1 bless $self, $class;
19  
20 1 return $self;
21 }
22  
23 2 ▶sub ok {
Subroutine ok: called CC=3 SCAR=11.0
Pod undocumented
24 2 my ( $self, %p ) = @_;
25  
26 2 my $context = Log::Log4perl::MDC->get_context;
27  
28 2 my $value = $context->{ $self->{KeyToMatch} };
29 return 1
30 2 ▶ if defined $value && $value =~ $self->{RegexToMatch};
Branch: 1 branch
BranchTrueFalseTotal
if defined $value and $value =~ /$self->{"RegexToMatch"}/ 1 1 2
Condition66%2/3
defined $value and $value =~ /$self->{"RegexToMatch"}/
!ll&&!rl&&r
101
MC/DC50%1/2
defined $value and $value =~ /$self->{"RegexToMatch"}/
defined $value $value =~ /$self->{"RegexToMatch"}/
Truth table66%2/3
A and B
A= defined $valueB= $value =~ /$self->{"RegexToMatch"}/
ABresult
0X0
100
111
31  
32 1 return 0;
33 }
34  
35 1 1;
36  
37 __END__
« Log4perl/Util/TimeTracker.pm ↑ Summary Log4perl/Layout/NoopLayout.pm »