| 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
| |||||||||||
| 29 | scalar(localtime(time)).caller()." $msg"."\n" if( $msg ); | ||||||||||
| 30 | |||||||||||
| 31 | 2 | return 1; | |||||||||
| 32 | |||||||||||
| 33 | } | ||||||||||
| 34 | |||||||||||
| 35 | 6 | 1; | |||||||||