Automation/Logging.pm

filter: Statementstmt 100% 14 / 14 Branchbran 50.0% 1 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 3 / 3 Podpod 100% 1 / 1 totaltotal 95.0% 19 / 20 CC 2 SCAR 4.1
CC
2
Cov
94%
log
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.5
« Automation/Unix.pm ↑ Summary
1 package App::Validation::Automation::Logging;
2
3 6 ▶use Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 6 ▶use English qw( -no_match_vars );
Subroutine BEGIN: called CC=1 SCAR=0.0
5
6 =head1 NAME
7
8 App::Validation::Automation::Logging - Role App::Validation::Automation
9
10 Logs message in the log file.The log filename is base script name followed by datestamp and log file extension.Logs for the same day get appened in the same log file.
11
12 =cut
13
14 6 requires qw( log_file_handle );
15
16 =head2 log
17
18 Logs messages with timestamp and caller info.
19
20 =cut
21
22 2 ▶sub log {
Subroutine log: called CC=2 SCAR=7.0
Pod documented
23
24 2 my $self = shift;
25 2 my $msg = shift;
26 2 local $OUTPUT_AUTOFLUSH = 1;
27
28 2 ▶ print { $self->log_file_handle }
Branch: 1 branch
BranchTrueFalseTotal
if $msg 2 0 2
29 scalar(localtime(time)).caller()." $msg"."\n" if( $msg );
30
31 2 return 1;
32
33 }
34
35 6 1;
« Automation/Unix.pm ↑ Summary