line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
=head1 NAME |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
Devel::PerlySense::Util::Log - Log routines |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
=cut |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
|
9
|
68
|
|
|
68
|
|
81063
|
use strict; |
|
68
|
|
|
|
|
74
|
|
|
68
|
|
|
|
|
1509
|
|
10
|
68
|
|
|
68
|
|
199
|
use warnings; |
|
68
|
|
|
|
|
75
|
|
|
68
|
|
|
|
|
1392
|
|
11
|
68
|
|
|
68
|
|
1140
|
use utf8; |
|
68
|
|
|
|
|
91
|
|
|
68
|
|
|
|
|
260
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
package Devel::PerlySense::Util::Log; |
14
|
|
|
|
|
|
|
$Devel::PerlySense::Util::Log::VERSION = '0.0218'; |
15
|
68
|
|
|
68
|
|
2488
|
use base "Exporter"; |
|
68
|
|
|
|
|
70
|
|
|
68
|
|
|
|
|
438
|
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
our @EXPORT = ( |
18
|
|
|
|
|
|
|
qw/ |
19
|
|
|
|
|
|
|
debug |
20
|
|
|
|
|
|
|
/); |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
|
27
|
68
|
|
|
68
|
|
5336
|
use Carp; |
|
68
|
|
|
|
|
104
|
|
|
68
|
|
|
|
|
2968
|
|
28
|
68
|
|
|
68
|
|
216
|
use Data::Dumper; |
|
68
|
|
|
|
|
78
|
|
|
68
|
|
|
|
|
2239
|
|
29
|
68
|
|
|
68
|
|
225
|
use File::Basename; |
|
68
|
|
|
|
|
110
|
|
|
68
|
|
|
|
|
2615
|
|
30
|
68
|
|
|
68
|
|
550
|
use Path::Class; |
|
68
|
|
|
|
|
28258
|
|
|
68
|
|
|
|
|
2356
|
|
31
|
|
|
|
|
|
|
|
32
|
68
|
|
|
68
|
|
16085
|
use Devel::PerlySense::Home; |
|
68
|
|
|
|
|
832
|
|
|
68
|
|
|
|
|
485
|
|
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=head1 ROUTINES |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=head2 debug($message) |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
Log debug $message to a log file in the HOME log directory. |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
Return 1. |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=cut |
47
|
|
|
|
|
|
|
my $fileDebug; |
48
|
|
|
|
|
|
|
my @aHistoryMessage; |
49
|
|
|
|
|
|
|
my $maxCountHistory = 200; |
50
|
|
|
|
|
|
|
sub debug { |
51
|
172
|
|
|
172
|
1
|
2893
|
my ($message) = @_; |
52
|
|
|
|
|
|
|
|
53
|
172
|
|
|
|
|
5944
|
my $messageLog = localtime() . ": $message\n"; |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
#Keep recent messages in memory for test diagnostics |
56
|
172
|
|
|
|
|
321
|
push(@aHistoryMessage, $messageLog); |
57
|
172
|
50
|
|
|
|
446
|
@aHistoryMessage > $maxCountHistory and shift(@aHistoryMessage); |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
|
60
|
172
|
50
|
|
|
|
1103
|
$0 =~ /\.t$/ and return 1; #Don't log when running tests |
61
|
|
|
|
|
|
|
|
62
|
0
|
0
|
0
|
|
|
|
$fileDebug ||= do { |
63
|
0
|
|
|
|
|
|
my $oHome = Devel::PerlySense::Home->new(); |
64
|
0
|
|
|
|
|
|
file($oHome->dirHomeLog, "debug.log"); |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
} or return 0; |
67
|
|
|
|
|
|
|
|
68
|
0
|
0
|
|
|
|
|
open(my $fh, ">>", $fileDebug) or return 0; |
69
|
0
|
|
|
|
|
|
$fh->print($messageLog); |
70
|
|
|
|
|
|
|
|
71
|
0
|
|
|
|
|
|
return(1); |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
#Debugging aid during CPAN testers failures |
79
|
|
|
|
|
|
|
#This is a hack, please ignore |
80
|
|
|
|
|
|
|
sub _textTailDebug { |
81
|
0
|
|
|
0
|
|
|
my $class = shift; |
82
|
0
|
|
|
|
|
|
return join("\n", @aHistoryMessage); |
83
|
|
|
|
|
|
|
} |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
1; |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
__END__ |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=encoding utf8 |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=head1 AUTHOR |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
Johan Lindstrom, C<< <johanl@cpan.org> >> |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=head1 BUGS |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
Please report any bugs or feature requests to |
106
|
|
|
|
|
|
|
C<bug-devel-perlysense@rt.cpan.org>, or through the web interface at |
107
|
|
|
|
|
|
|
L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Devel-PerlySense>. |
108
|
|
|
|
|
|
|
I will be notified, and then you'll automatically be notified of progress on |
109
|
|
|
|
|
|
|
your bug as I make changes. |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
=head1 ACKNOWLEDGEMENTS |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=head1 COPYRIGHT & LICENSE |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
Copyright 2005 Johan Lindstrom, All Rights Reserved. |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
118
|
|
|
|
|
|
|
under the same terms as Perl itself. |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
=cut |