line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
=head1 NAME |
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
Log::Fine::Levels::Java - Provides levels correlating to java.utils.logging |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
=head1 SYNOPSIS |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
Defines log level values and masks correlating to those provided by |
9
|
|
|
|
|
|
|
java.utils.logging |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
use Log::Fine; |
12
|
|
|
|
|
|
|
use Log::Fine::Levels::Java; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
# Grab a logging object |
15
|
|
|
|
|
|
|
my $log = Log::Fine->getLogger("foo1"); |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
# Note that FINER and SEVERE are provided by the |
18
|
|
|
|
|
|
|
# Log::Fine::Levels::Java object |
19
|
|
|
|
|
|
|
$log->log(FINER, "I'm not mad at you, I'm mad at the dirt"); |
20
|
|
|
|
|
|
|
$log->log(SEVERE, "No more wire hangers ... EVER!"); |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=head1 DESCRIPTION |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
Log::Fine::Levels::Java provides logging and mask constants mimicking |
25
|
|
|
|
|
|
|
those provided by the C framework as provided by |
26
|
|
|
|
|
|
|
Java 1.5.0 |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=cut |
29
|
|
|
|
|
|
|
|
30
|
3
|
|
|
3
|
|
1403
|
use strict; |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
62
|
|
31
|
3
|
|
|
3
|
|
9
|
use warnings; |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
73
|
|
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
package Log::Fine::Levels::Java; |
34
|
|
|
|
|
|
|
|
35
|
3
|
|
|
3
|
|
828
|
use AutoLoader; |
|
3
|
|
|
|
|
2145
|
|
|
3
|
|
|
|
|
11
|
|
36
|
3
|
|
|
3
|
|
76
|
use Carp; |
|
3
|
|
|
|
|
3
|
|
|
3
|
|
|
|
|
129
|
|
37
|
3
|
|
|
3
|
|
9
|
use Exporter; |
|
3
|
|
|
|
|
2
|
|
|
3
|
|
|
|
|
77
|
|
38
|
3
|
|
|
3
|
|
9
|
use POSIX qw( strftime ); |
|
3
|
|
|
|
|
3
|
|
|
3
|
|
|
|
|
12
|
|
39
|
|
|
|
|
|
|
|
40
|
3
|
|
|
3
|
|
119
|
use base qw/ Log::Fine::Levels Exporter /; |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
300
|
|
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
our $VERSION = $Log::Fine::Levels::VERSION; |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
# Necessary for AutoLoader |
45
|
|
|
|
|
|
|
our $AUTOLOAD; |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=head2 Log Levels |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
Log::Fine::Levels::Java bases its log levels on those provided by |
50
|
|
|
|
|
|
|
C. See |
51
|
|
|
|
|
|
|
L |
52
|
|
|
|
|
|
|
for further specifics. |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=over 4 |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=item * C |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=item * C |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=item * C |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=item * C |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=item * C |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=item * C |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=item * C |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=back |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=cut |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
# Default level-to-value hash |
75
|
3
|
|
|
|
|
265
|
use constant LVLTOVAL_MAP => { |
76
|
|
|
|
|
|
|
SEVERE => 0, |
77
|
|
|
|
|
|
|
WARNING => 1, |
78
|
|
|
|
|
|
|
INFO => 2, |
79
|
|
|
|
|
|
|
CONFIG => 3, |
80
|
|
|
|
|
|
|
FINE => 4, |
81
|
|
|
|
|
|
|
FINER => 5, |
82
|
|
|
|
|
|
|
FINEST => 6, |
83
|
3
|
|
|
3
|
|
10
|
}; # LVLTOVAL_MAP{} |
|
3
|
|
|
|
|
3
|
|
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
# Default value-to-level hash |
86
|
|
|
|
|
|
|
use constant VALTOLVL_MAP => { |
87
|
|
|
|
|
|
|
LVLTOVAL_MAP->{SEVERE} => "SEVERE", |
88
|
|
|
|
|
|
|
LVLTOVAL_MAP->{WARNING} => "WARNING", |
89
|
|
|
|
|
|
|
LVLTOVAL_MAP->{INFO} => "INFO", |
90
|
|
|
|
|
|
|
LVLTOVAL_MAP->{CONFIG} => "CONFIG", |
91
|
|
|
|
|
|
|
LVLTOVAL_MAP->{FINE} => "FINE", |
92
|
|
|
|
|
|
|
LVLTOVAL_MAP->{FINER} => "FINER", |
93
|
3
|
|
|
|
|
246
|
LVLTOVAL_MAP->{FINEST} => "FINEST", |
94
|
3
|
|
|
3
|
|
11
|
}; # VALTOLVL_MAP{} |
|
3
|
|
|
|
|
3
|
|
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=head2 Log Masks |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
Log masks can be exported for use in setting up individual handles |
99
|
|
|
|
|
|
|
(see L). The following masks are exported into the |
100
|
|
|
|
|
|
|
caller namespace: |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=over 4 |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=item * C |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
=item * C |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=item * C |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
=item * C |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=item * C |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
=item * C |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=item * C |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=back |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
See L for more information. |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
=cut |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
use constant MASK_MAP => { |
125
|
|
|
|
|
|
|
LOGMASK_SEVERE => 2 << LVLTOVAL_MAP->{SEVERE}, |
126
|
|
|
|
|
|
|
LOGMASK_WARNING => 2 << LVLTOVAL_MAP->{WARNING}, |
127
|
|
|
|
|
|
|
LOGMASK_INFO => 2 << LVLTOVAL_MAP->{INFO}, |
128
|
|
|
|
|
|
|
LOGMASK_CONFIG => 2 << LVLTOVAL_MAP->{CONFIG}, |
129
|
|
|
|
|
|
|
LOGMASK_FINE => 2 << LVLTOVAL_MAP->{FINE}, |
130
|
|
|
|
|
|
|
LOGMASK_FINER => 2 << LVLTOVAL_MAP->{FINER}, |
131
|
|
|
|
|
|
|
LOGMASK_FINEST => 2 << LVLTOVAL_MAP->{FINEST}, |
132
|
3
|
|
|
3
|
|
9
|
}; # MASK_MAP{} |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
765
|
|
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
# -------------------------------------------------------------------- |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
# grab appropriate refs |
137
|
|
|
|
|
|
|
my $levels = LVLTOVAL_MAP; |
138
|
|
|
|
|
|
|
my $masks = MASK_MAP; |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
# Exported tags |
141
|
|
|
|
|
|
|
our %EXPORT_TAGS = (macros => [ keys %{$levels} ], |
142
|
|
|
|
|
|
|
masks => [ keys %{$masks} ]); # EXPORT_TAGS |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
# Exported macros |
145
|
|
|
|
|
|
|
our @EXPORT = (@{ $EXPORT_TAGS{macros} }); |
146
|
|
|
|
|
|
|
our @EXPORT_OK = (@{ $EXPORT_TAGS{masks} }); |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
# functions okay to export |
149
|
|
|
|
|
|
|
our %ok_fields = (%{$levels}, %{$masks}); |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
# -------------------------------------------------------------------- |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
=head1 CONSTRUCTOR |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
=head2 new |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
Returns a newly constructed object |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
=cut |
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
sub new |
162
|
|
|
|
|
|
|
{ |
163
|
|
|
|
|
|
|
|
164
|
1
|
|
|
1
|
1
|
80893
|
my $class = shift; |
165
|
1
|
|
|
|
|
4
|
return bless { levelclass => $class }, $class; |
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
} # new() |
168
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
# Autoloader |
170
|
|
|
|
|
|
|
# -------------------------------------------------------------------- |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
sub AUTOLOAD |
173
|
|
|
|
|
|
|
{ |
174
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
# Get the method name |
176
|
17
|
|
|
17
|
|
22
|
my $name = $AUTOLOAD; |
177
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
# Strip out package prefix |
179
|
17
|
|
|
|
|
66
|
$name =~ s/.*://; |
180
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
# Return on DESTROY |
182
|
17
|
50
|
|
|
|
40
|
return if $name eq 'DESTROY'; |
183
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
# make sure we have a valid function |
185
|
|
|
|
|
|
|
croak( |
186
|
|
|
|
|
|
|
sprintf("[%s] {%s} FATAL : %s\n", |
187
|
|
|
|
|
|
|
strftime("%c", localtime(time)), |
188
|
|
|
|
|
|
|
$AUTOLOAD, "Invalid function name : $name" |
189
|
17
|
50
|
|
|
|
37
|
)) unless (exists $ok_fields{$name}); |
190
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
# Evaluate and return the appropriate level |
192
|
17
|
|
|
34
|
1
|
671
|
eval "sub $name { return $ok_fields{$name} }"; |
|
34
|
|
|
66
|
1
|
16369
|
|
|
66
|
|
|
139
|
1
|
28156
|
|
|
139
|
|
|
18
|
1
|
56369
|
|
|
18
|
|
|
1
|
1
|
6874
|
|
|
1
|
|
|
1
|
1
|
4
|
|
|
1
|
|
|
1
|
1
|
3
|
|
|
1
|
|
|
1
|
1
|
4
|
|
|
1
|
|
|
1
|
1
|
3
|
|
|
1
|
|
|
1
|
1
|
5
|
|
|
1
|
|
|
3
|
1
|
4
|
|
|
3
|
|
|
5
|
1
|
1214
|
|
|
5
|
|
|
|
|
2141
|
|
193
|
17
|
|
|
|
|
476
|
goto &$name; |
194
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
} # AUTOLOAD() |
196
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
=head1 BUGS |
198
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
Please report any bugs or feature requests to |
200
|
|
|
|
|
|
|
C, or through the web interface at |
201
|
|
|
|
|
|
|
L. |
202
|
|
|
|
|
|
|
I will be notified, and then you'll automatically be notified of progress on |
203
|
|
|
|
|
|
|
your bug as I make changes. |
204
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
=head1 SUPPORT |
206
|
|
|
|
|
|
|
|
207
|
|
|
|
|
|
|
You can find documentation for this module with the perldoc command. |
208
|
|
|
|
|
|
|
|
209
|
|
|
|
|
|
|
perldoc Log::Fine::Levels::Java |
210
|
|
|
|
|
|
|
|
211
|
|
|
|
|
|
|
You can also look for information at: |
212
|
|
|
|
|
|
|
|
213
|
|
|
|
|
|
|
=over 4 |
214
|
|
|
|
|
|
|
|
215
|
|
|
|
|
|
|
=item * AnnoCPAN: Annotated CPAN documentation |
216
|
|
|
|
|
|
|
|
217
|
|
|
|
|
|
|
L |
218
|
|
|
|
|
|
|
|
219
|
|
|
|
|
|
|
=item * CPAN Ratings |
220
|
|
|
|
|
|
|
|
221
|
|
|
|
|
|
|
L |
222
|
|
|
|
|
|
|
|
223
|
|
|
|
|
|
|
=item * RT: CPAN's request tracker |
224
|
|
|
|
|
|
|
|
225
|
|
|
|
|
|
|
L |
226
|
|
|
|
|
|
|
|
227
|
|
|
|
|
|
|
=item * Search CPAN |
228
|
|
|
|
|
|
|
|
229
|
|
|
|
|
|
|
L |
230
|
|
|
|
|
|
|
|
231
|
|
|
|
|
|
|
=back |
232
|
|
|
|
|
|
|
|
233
|
|
|
|
|
|
|
=head1 AUTHOR |
234
|
|
|
|
|
|
|
|
235
|
|
|
|
|
|
|
Christopher M. Fuhrman, C<< >> |
236
|
|
|
|
|
|
|
|
237
|
|
|
|
|
|
|
=head1 SEE ALSO |
238
|
|
|
|
|
|
|
|
239
|
|
|
|
|
|
|
L, L, L, L, L, |
240
|
|
|
|
|
|
|
L |
241
|
|
|
|
|
|
|
|
242
|
|
|
|
|
|
|
=head1 COPYRIGHT & LICENSE |
243
|
|
|
|
|
|
|
|
244
|
|
|
|
|
|
|
Copyright (c) 2010, 2013 Christopher M. Fuhrman, |
245
|
|
|
|
|
|
|
All rights reserved. |
246
|
|
|
|
|
|
|
|
247
|
|
|
|
|
|
|
This program is free software licensed under the... |
248
|
|
|
|
|
|
|
|
249
|
|
|
|
|
|
|
The BSD License |
250
|
|
|
|
|
|
|
|
251
|
|
|
|
|
|
|
The full text of the license can be found in the |
252
|
|
|
|
|
|
|
LICENSE file included with this module. |
253
|
|
|
|
|
|
|
|
254
|
|
|
|
|
|
|
=cut |
255
|
|
|
|
|
|
|
|
256
|
|
|
|
|
|
|
1; # End of Log::Fine::Levels::Java |
257
|
|
|
|
|
|
|
|
258
|
|
|
|
|
|
|
__END__ |