Branch Coverage

blib/lib/BGPmon/Log.pm
Criterion Covered Total %
branch 74 82 90.2


line true false branch
349 0 25 unless (defined $hostname)
359 8 17 if (defined $args{'prog_name'})
360 7 1 if ($args{'prog_name'} =~ /^[[:print:]]*$/u) { }
361 1 6 if (length $args{'prog_name'} > 256)
374 9 14 if (defined $args{'log_level'})
376 2 7 if ($args{'log_level'} =~ /\D/u)
383 1 6 if ($args{'log_level'} < 0 or $args{'log_level'} > 7)
390 8 12 if (defined $args{'log_facility'})
392 2 6 if ($args{'log_facility'} =~ /\D/u)
400 11 7 if (defined $args{'log_file'})
401 10 1 if ($args{'log_file'} =~ /^[[:print:]]*$/u) { }
402 1 9 if (length $args{'log_file'} > 256)
415 10 6 if (defined $args{'use_syslog'})
417 1 9 if ($args{'use_syslog'} =~ /\D/u)
424 1 8 if ($args{'use_syslog'} != 0 and $args{'use_syslog'} != 1)
431 8 6 if (defined $args{'use_gmt'})
433 1 7 if ($args{'use_gmt'} =~ /\D/u)
440 1 6 if ($args{'use_gmt'} != 0 and $args{'use_gmt'} != 1)
445 1 5 if ($use_syslog == 1)
454 2 9 if ($use_syslog == 1 and defined $log_file)
461 0 9 if ($use_syslog == 1)
462 0 0 unless (Sys::Syslog::openlog($prog_name, 'ndelay,pid', $log_facility))
474 7 2 if (defined $log_file)
475 1 6 unless (open $log_fh, ">>$log_file")
512 8 1 if ($log_initialized)
518 0 8 if ($use_syslog) { }
6 2 elsif (not $use_stderr) { }
656 1 74 unless (defined $function)
661 1 73 unless (defined $error_code{$function})
681 2 76 unless (defined $function)
686 2 74 unless (defined $error_msg{$function})
721 0 39 unless (defined $function_name)
727 2 37 if ($log_initialized == 0)
734 1 36 unless (defined $msg)
741 35 1 if ($msg =~ /^[[:print:]]*$/u) { }
742 1 34 if (length $msg > 256)
755 1 33 unless (defined $function_level{$function_name} and defined $function_description{$function_name})
763 6 27 if ($function_level{$function_name} > $log_level)
770 0 27 if ($use_syslog == 1)
779 26 1 if ($use_gmt) { }
792 0 27 if (not defined $bytes_written or $bytes_written == 0 or $bytes_written != length $msg)