line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
=head1 NAME |
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
Log::Fine::Handle::String - formatted output |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
=head1 SYNOPSIS |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
Returns the formatted string for testing purposes. |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
use Log::Fine; |
11
|
|
|
|
|
|
|
use Log::Fine::Handle::String; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
# Get a new logger |
14
|
|
|
|
|
|
|
my $log = Log::Fine->logger("foo"); |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
# register a file handle |
17
|
|
|
|
|
|
|
my $handle = Log::Fine::Handle::String->new(); |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
# get a formatted message |
20
|
|
|
|
|
|
|
my $formatted_message = $log->(INFO, "Opened new log handle"); |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=head1 DESCRIPTION |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
The string handle returns the formatted message. This is useful for |
25
|
|
|
|
|
|
|
general-purpose testing and verification. |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=cut |
28
|
|
|
|
|
|
|
|
29
|
6
|
|
|
6
|
|
2471
|
use strict; |
|
6
|
|
|
|
|
7
|
|
|
6
|
|
|
|
|
132
|
|
30
|
6
|
|
|
6
|
|
17
|
use warnings; |
|
6
|
|
|
|
|
6
|
|
|
6
|
|
|
|
|
171
|
|
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
package Log::Fine::Handle::String; |
33
|
|
|
|
|
|
|
|
34
|
6
|
|
|
6
|
|
17
|
use base qw( Log::Fine::Handle ); |
|
6
|
|
|
|
|
5
|
|
|
6
|
|
|
|
|
1423
|
|
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
our $VERSION = $Log::Fine::Handle::VERSION; |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=head1 METHODS |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=head2 msgWrite |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
Returns the formatted message |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
B msgWrite() is an I method to the Log::Fine |
45
|
|
|
|
|
|
|
framework, meant to be sub-classed. Use |
46
|
|
|
|
|
|
|
L for actual logging. |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=head3 Parameters |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=over |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=item * level |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
Level at which to log |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=item * message |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
Message to log |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=item * skip |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
Passed to L for accurate method logging |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=back |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=head3 Returns |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
The formatted message |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=cut |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
sub msgWrite |
73
|
|
|
|
|
|
|
{ |
74
|
|
|
|
|
|
|
|
75
|
2
|
|
|
2
|
1
|
3
|
my $self = shift; |
76
|
2
|
|
|
|
|
2
|
my $lvl = shift; |
77
|
2
|
|
|
|
|
4
|
my $msg = shift; |
78
|
2
|
|
|
|
|
2
|
my $skip = shift; # NOT USED |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
# Validate formatter |
81
|
2
|
|
|
|
|
89
|
eval "require " . ref $self->{formatter}; |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
# Should we have a formatter defined, then use that, |
84
|
|
|
|
|
|
|
# otherwise, just print the raw message |
85
|
|
|
|
|
|
|
$msg = $self->{formatter}->format($lvl, $msg, $skip) |
86
|
2
|
50
|
|
|
|
13
|
if defined $self->{formatter}; |
87
|
|
|
|
|
|
|
|
88
|
2
|
|
|
|
|
7
|
return $msg; |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
} # msgWrite() |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=head1 BUGS |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
Please report any bugs or feature requests to |
95
|
|
|
|
|
|
|
C, or through the web interface at |
96
|
|
|
|
|
|
|
L. |
97
|
|
|
|
|
|
|
I will be notified, and then you'll automatically be notified of progress on |
98
|
|
|
|
|
|
|
your bug as I make changes. |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=head1 SUPPORT |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
You can find documentation for this module with the perldoc command. |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
perldoc Log::Fine |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
You can also look for information at: |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=over 4 |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
=item * AnnoCPAN: Annotated CPAN documentation |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
L |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
=item * CPAN Ratings |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
L |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=item * RT: CPAN's request tracker |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
L |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
=item * Search CPAN |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
L |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
=back |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
=head1 AUTHOR |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
Christopher M. Fuhrman, C<< >> |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
=head1 SEE ALSO |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
L, L, L |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
=head1 COPYRIGHT & LICENSE |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
Copyright (c) 2008, 2010, 2013 Christopher M. Fuhrman, |
139
|
|
|
|
|
|
|
All rights reserved. |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
This program is free software licensed under the... |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
The BSD License |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
The full text of the license can be found in the |
146
|
|
|
|
|
|
|
LICENSE file included with this module. |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
=cut |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
1; # End of Log::Fine::Handle::String |