Branch Coverage

blib/lib/Log/Easy.pm
Criterion Covered Total %
branch 154 630 24.4


line true false branch
14 0 1 if $ENV{'LOG_FILTER_DEBUG'}
17 0 1 unless open FILTER, "<$filter_file"
22 0 1 if $ENV{'LOG_FILTER_DEBUG'}
23 1 0 exists $ENV{'LOG_FILTER_DEBUG'} ? :
1 0 exists $ENV{'LOG_FILTER_PACKAGES_DEBUG'} ? :
0 1 if $ENV{'LOG_FILTER_DEBUG'}
0 0 if $ENV{'LOG_FILTER_DEBUG'}
0 1 if $ENV{'LOG_FILTER_DEBUG'}
0 0 if $ENV{'LOG_FILTER_DEBUG'}
0 0 if ($piece =~ /^\!/) { }
0 0 if $ENV{'LOG_FILTER_DEBUG'}
0 0 if $ENV{'LOG_FILTER_DEBUG'}
0 0 if $ENV{'LOG_FILTER_DEBUG'}
0 0 $_ =~ /$not_filter_rx/ ? :
0 0 $_ =~ /$not_filter_rx/ ? :
0 0 if (scalar keys %filter) { }
0 1 if ($ENV{'LOG_FILTER'} =~ /^off$/i) { }
1 0 elsif ($ENV{'LOG_FILTER'} =~ /^(on|\d+)$/i) { }
0 1 if $ENV{'LOG_FILTER_DEBUG'}
0 1 if $ENV{'LOG_FILTER_DEBUG'}
0 1 if $ENV{'LOG_FILTER_DEBUG'}
0 1 if $ENV{'LOG_FILTER_DEBUG'}
1 0 unless (defined $FILTER_REGEX)
0 1 if $ENV{'LOG_FILTER_DEBUG'}
1 0 unless (defined $FILTER_ALL_REGEX)
0 1 if $ENV{'LOG_FILTER_DEBUG'}
1 0 unless (defined $MATCH_LOG_LEVEL_REGEX)
0 4630 unless defined $max
4630 0 unless (defined $separator and length $separator > 0)
4630 0 defined $piece ? :
782 3848 $lp < $max ? :
0 4630 $sp eq 'space' ? :
0 4630 $lr < $max ? :
0 4630 $sp eq 'space' ? :
0 4630 unless defined $max
4630 0 unless (defined $separator and length $separator > 0)
4630 0 defined $piece ? :
0 4630 $lp < $max ? :
4630 0 $sp eq 'space' ? :
0 4630 $lr < $max ? :
4630 0 $sp eq 'space' ? :
0 0 unless defined $max
0 0 unless (defined $separator and length $separator > 0)
0 0 defined $piece ? :
0 0 $lp < $max ? :
0 0 $sp eq 'space' ? :
0 0 $lr < $max ? :
0 0 $sp eq 'space' ? :
24 0 1 if $ENV{'LOG_FILTER_DEBUG'}
25 0 1 if $@
309 1 0 unless $log_level
338 1 0 unless $log_level
343 0 0 exists $_[1] ? :
344 0 0 exists $_[1] ? :
352 62 0 exists $_[1] ? :
353 6 0 exists $_[1] ? :
354 7 0 exists $_[1] ? :
355 6 0 exists $_[1] ? :
356 0 0 exists $_[1] ? :
357 0 0 exists $_[1] ? :
358 2 0 exists $_[1] ? :
359 0 0 exists $_[1] ? :
360 6 0 exists $_[1] ? :
374 48 3088 $_ eq $level ? :
56 0 if $level
375 8 48 if ($level and not $valid_level) { }
48 0 elsif ($level and $valid_level) { }
376 0 8 if ($dest) { }
385 56 0 if ($dest)
399 0 0 if (scalar @_ > 2)
419 0 0 unless ($level or $dest)
428 0 0 if (not ref $level eq 'ARRAY') { }
435 0 0 if ($level and not $dest)
437 0 0 $_ eq $$level[0] ? :
0 0 if $$level[0]
438 0 0 if ($valid_level) { }
441 0 0 $_ eq $l ? :
442 0 0 if (not $vl) { }
452 0 0 $reflevel ? :
463 0 0 if (not ref $dest eq 'ARRAY') { }
467 0 0 defined $refdest ? :
470 0 0 if ($dest and not $level)
495 0 0 if (exists $_[0])
503 0 0 unless $package and not $package =~ /^\s+$/
504 0 0 if $ENV{'LOG_PACKAGES_DEBUG'}
505 0 0 if ($package =~ s/^\!//) { }
507 0 0 unless (grep {/^$package$/;} @$dont_log)
508 0 0 if $ENV{'LOG_PACKAGES_DEBUG'}
512 0 0 unless (grep {/^$package$/;} @$do_log)
513 0 0 if $ENV{'LOG_PACKAGES_DEBUG'}
519 0 0 if (my $packages = $$self{'packages_array'})
521 0 0 if $ENV{'LOG_PACKAGES_DEBUG'}
523 0 0 if $ENV{'LOG_PACKAGES_DEBUG'}
525 0 0 scalar @$do_log ? :
526 0 0 if $ENV{'LOG_PACKAGES_DEBUG'}
527 0 0 scalar @$dont_log ? :
528 0 0 if $ENV{'LOG_PACKAGES_DEBUG'}
540 0 0 if UNIVERSAL::isa($clone, $this_package) and ref $$self{'prefix'} eq 'CODE'
560 4 2 if (defined $init) { }
561 0 4 unless (ref $init eq 'HASH')
570 0 37 unless $key
584 0 0 if $ENV{'LOG_INTERNAL_DUMP_DEBUG'}
588 0 0 if ($_[0] and $_[0] =~ /^-/) { }
592 0 0 unless ref $names eq 'ARRAY'
595 0 0 defined $$args{-'indent'} ? :
0 0 defined $$args{-'i'} ? :
599 0 0 if ($terse and not defined $indent)
602 0 0 unless (defined $indent)
615 0 0 if $ENV{'LOG_INTERNAL_DUMP_DEBUG'}
617 0 0 unless defined $dumps and ref $dumps eq 'ARRAY'
618 0 0 unless defined $names and ref $names eq 'ARRAY'
619 0 0 if ($id)
622 0 0 ref $d ? :
628 0 0 if $pad
629 0 0 if $pure
630 0 0 if $deep
631 0 0 if $terse
632 0 0 if defined $indent
642 0 0 ref $_[0] eq 'HASH' ? :
645 0 0 ref $_[0] eq 'HASH' ? :
653 0 0 if (not $$config{'nohelp'} or exists $$config{'help'} and $$config{'help'})
657 0 0 $$config{'no_usage'} || scalar grep({/no_usage/;} @_) ? :
659 0 0 $$config{'no_missing'} || scalar grep({/no_missing/;} @_) ? :
661 0 0 $_ =~ /^no_/ ? :
0 0 $$optconfig{$_} ? :
669 0 0 if ($progopt =~ /^([:=]+)([ifs\@%])$/) { }
683 0 0 ref $$optargs{$_}[1] ? :
698 0 0 $no_missing ? :
709 0 0 defined $$optargs{$key}[1] ? :
712 0 0 if ($key =~ /\|/) { }
719 0 0 if (ref $value eq 'SCALAR') { }
0 0 elsif (ref $value eq 'CODE') { }
0 0 elsif (ref $value eq 'ARRAY') { }
726 0 0 if (ref $item eq 'ARRAY') { }
740 0 0 if scalar @missing and not $no_usage
759 0 0 if $key =~ /^(usage|help)$/
763 0 0 if ref $value eq 'SCALAR'
765 0 0 if ($key =~ /\|/) { }
774 0 0 defined $$options{$alias} ? :
783 0 0 unless $optspec
790 0 0 ref $value eq 'ARRAY' ? :
792 0 0 if ($optspec =~ /^\=/)
794 0 0 if (not defined $optval or $optval ne '0' and not $optval)
814 0 0 ref $_[0] eq 'HASH' ? :
816 0 0 ref $_[0] eq 'HASH' ? :
818 0 0 ref $_[0] eq 'HASH' ? :
821 0 0 if (not $$config{'nohelp'} or exists $$config{'help'} and $$config{'help'})
829 0 0 defined $_ ? :
0 0 scalar grep({/no_missing/;} map({defined $_ ? $_ : ();} @_)) ? :
830 0 0 $_[0] ? :
0 0 ref $_[0] eq 'HASH' ? :
832 0 0 scalar @_ ? :
0 0 unless ref $usage_args eq 'HASH'
833 0 0 $options ? :
838 0 0 $a =~ /^\=/ ? :
842 0 0 $a =~ /^\=/ ? :
845 0 0 $$optargs{$_} ? :
0 0 scalar @missing ? :
856 0 0 defined $options{$_} ? :
865 0 0 $$config{'usage_message'} ? :
0 0 $no_missing ? :
869 0 0 if ref $val eq 'SCALAR'
870 0 0 if ref $val eq 'ARRAY'
871 0 0 if ref $val eq 'HASH'
874 0 0 if $label =~ /\|/
875 0 0 $$optargs{$_}[0] =~ /^\=/ ? :
879 0 0 $type ? :
880 0 0 $boolean ? :
883 0 0 $required ? :
885 0 0 if (scalar @wrap == 1)
890 0 0 if ('CODE' eq ref $val and not $_ =~ /(usage|help)/ and not $already_decoded{$val}++)
896 0 0 if (defined $val and $val || $val eq '0')
897 0 0 $boolean ? :
899 0 0 $boolean && $val ? :
900 0 0 $val ? :
0 0 $boolean ? :
0 0 $boolean ? :
0 0 $val ? :
0 0 $boolean ? :
0 0 $boolean ? :
0 0 $val ? :
0 0 $required ? :
917 0 0 unless exists $$config{'exit'}
918 0 0 if $$config{'exit'}
1021 1852 0 length $_ < 2 ? :
576 2202 length $_ < 2 ? :
1025 0 926 if $ENV{'LOG_INTERNAL_DEBUG'} > 2
1036 0 0 if $ENV{'LOG_INTERNAL_DEBUG'} > 2
1046 0 926 if $ENV{'LOG_INTERNAL_DEBUG'} > 2
1059 56 870 if $level =~ /CLEAN/
1069 0 0 if ref $level eq 'HASH' and $args = $level
1081 0 0 if $ENV{'LOG_LEVEL_DEBUG'}
1083 0 0 unless (defined $_level)
1086 0 0 unless exists $level_cache{$level}
1101 0 6273 unless ref $self
1102 0 6273 if $ENV{'LOG_INTERNAL_DEBUG'} > 4
1118 6272 1 if ref $level eq 'HASH' and $args = $level
1133 0 6273 if $ENV{'LOG_LEVEL_DEBUG'}
1135 0 6273 unless (defined $_level)
1139 0 0 if (not exists $level_cache{$level}) { }
1159 0 6273 if $ENV{'LOG_INTERNAL_DEBUG'} > 4
1160 2128 4145 unless ($ALWAYS_LOG{$map_level})
1161 0 2128 if (my $e = $$self{'exclusive'}) { }
1162 0 0 unless $level =~ /$e/
1165 1284 844 unless $_level >= $_log_level
1170 0 6273 if $ENV{'LOG_INTERNAL_DEBUG'} > 4
1171 0 6273 if ($status and my $packages = $$self{'packages'})
1182 0 0 if (scalar @$do_log_rx)
1184 0 0 if ($log_called_package =~ /^($do_rx)$/)
1190 0 0 unless $do_match
1193 0 0 if ($status and scalar @$dont_log_rx)
1195 0 0 if ($status and $log_called_package =~ /^($dont_rx)$/)
1207 0 0 if ($do_match and $dont_match)
1209 0 0 length $do_match > length $dont_match ? :
1210 0 0 if $ENV{'LOG_PACKAGES_DEBUG'}
1211 0 0 if $ENV{'LOG_PACKAGES_DEBUG'}
1215 0 6273 if $ENV{'LOG_INTERNAL_DEBUG'} > 2
1216 4989 1284 if ($status)
1227 4989 0 exists $$self{'dump_refs'} ? :
0 4989 exists $$args{'dump_refs'} ? :
1233 0 0 $use_level =~ /FAIL/ ? :
0 0 $use_level =~ /FATAL/ ? :
0 0 $use_level =~ /CRIT/ ? :
0 0 $log_level =~ /(SPEW)/ ? :
0 0 $use_level =~ /^D/ ? :
870 0 defined $$self{'prefix'} ? :
3193 870 $use_level =~ /CLEAN/ ? :
926 4063 $log_level =~ /^D_/ ? :
0 4989 exists $$args{'prefix'} ? :
1248 0 0 if (exists $$args{'prefix'} and $log_level =~ /^D_/ and $log_file =~ /^(STDOUT|STDERR)$/)
1254 0 4989 if $add_dev_prefix
1255 4989 0 if defined $prefix
1260 0 4989 defined $$self{'stack_trace'} ? :
0 4989 exists $$args{'stack_trace'} ? :
1268 0 926 if $code_resolve_cnt++ > $code_resolve_cnt_max
1282 0 14966 unless defined $msg
1285 0 14966 if (my $ref = ref $msg and $dump_refs)
1287 0 0 $_ =~ /^(terse|deep|pure|id|indent)$/ ? :
1288 0 0 if $ENV{'LOG_INTERNAL_DEBUG'} > 4
1289 0 0 if ($ref eq 'CODE') { }
1292 0 0 unless ref $msg eq 'CODE' and $code_resolve_cnt++ > $code_resolve_cnt_max
1305 0 4989 if ($add_dev_prefix and not $outmsg[-1] =~ /\n$/ms)
1314 3136 1853 exists $$args{'n'} ? :
1315 0 4989 if $ENV{'LOG_INTERNAL_DEBUG'} > 4
1316 4989 0 unless ($$args{'dont_actually_log'})
1330 0 4989 if (not $fh) { }
1334 0 0 unless ($log->handle_fatals)
1338 0 0 if $log->handle_fatals
1349 0 4989 unless defined $return
1361 2568 0 defined $_ ? :
1284 4989 if ref $return eq 'ARRAY'
1363 6272 1 wantarray ? :
1375 0 0 unless ($fh)
1379 0 0 unless ($log->handle_fatals)
1394 0 0 exists $_[0] ? :
1416 926 1852 if ($nsubroutine) { }
926 926 elsif ($package) { }
1430 0 926 if ($STACK_TRACE)
1435 0 0 $mes{$_} < length $_ ? :
0 0 !$mes{$_} ? :
1443 0 0 $f{$_} ? :
0 0 unless join '', map({$f{$_} ? $f{$_} : '';} @showf)
1447 0 0 $mes{$_} < length $f{$_} ? :
0 0 !$mes{$_} ? :
1452 0 0 if ($_) { }
1456 0 926 if $ENV{'LOG_DEBUG'}
1458 0 926 if $ENV{'LOG_DEBUG'}
1459 0 926 unless ($$log_called_at[0])
1463 926 0 unless ($$called_called_from[0])
1466 0 926 if $ENV{'LOG_DEBUG'}
1467 0 926 if $ENV{'LOG_DEBUG'}
1468 0 926 if $ENV{'LOG_DEBUG'}
1471 926 0 wantarray ? :
1495 3 0 unless ref $self
1500 3 0 if (my $init = shift @args)
1501 3 0 if ref $init eq 'HASH'
1502 0 3 if ref $init eq 'ARRAY'
1505 1 0 $class eq $this_package ? :
1507 3 0 if $log
1520 0 0 if (my $fh = $self->fh(@_, 'no_open', 1)) { }
1527 0 0 if ($ENV{'LOG_DEBUG'})
1532 0 0 if ($fh and $file_no)
1533 0 0 unless $status = close $fh
1559 0 4989 if ($level =~ /^(STDERR|STDOUT)$/i) { }
1597 0 4989 if (ref $fh eq 'ARRAY') { }
1605 0 4989 if ($fh)
1610 0 0 if (defined $file_no) { }
1620 0 0 $reffh ? :
1625 0 4989 if (ref $file eq 'ARRAY') { }
1641 0 4989 if ($$args{'no_open'}) { }
1644 1 4988 unless ($_fh)
1645 0 1 if (fileno $_file) { }
1649 0 1 if ($_file =~ /^\s*(\||[>]{1,2})/) { }
1652 0 1 -f $_file_clean ? :
1654 0 1 unless $_fh = 'IO::File'->new
1655 0 1 if $ENV{'LOG_DEBUG'}
1657 0 1 unless ($opened)
1659 0 0 unless ($log->handle_fatals)
1670 0 4989 unless defined $_file_no
1689 4989 0 if $$self{'unbuffer'} or $$args{'unbuffer'}
1696 0 4989 $reffile ? :
1715 4989 0 if ($_[0] =~ /^-/) { }
1717 0 4989 unless $message = $$args{-'message'}
1718 0 4989 unless ref $message eq 'ARRAY'
1721 0 0 if $fh = $FHS_NA{$_[0]}
1724 0 0 defined $_ ? :
1731 0 4989 if ($$args{-'terse'})
1738 0 4989 if (ref $fh eq 'ARRAY') { }
1748 0 4989 unless fileno $_fh or $_fh = $FHS_NA{$_fh}
1750 0 4989 unless print $_fh $return, $n
1755 0 112 defined $$args{'handle_fatals'} ? :
0 112 if ($level =~ /^(CRIT|FATAL)$/ and defined $$args{'handle_fatals'} ? $$args{'handle_fatals'} : $$self{'handle_fatals'})
1762 0 4989 if ($BIG_WARN_ON{$level})
1769 56 4933 if ($level eq 'QUIT')
1770 0 56 unless $$self{'DEBUG'}{'NO_QUIT'}