Medley/Logger.pm

filter: Statementstmt 64.4% 559 / 867 Branchbran 26.3% 121 / 460 Conditioncond 4.1% 1 / 24 MC/DCmcdc 0.0% 0 / 16 Subroutinesub 88.4% 115 / 130 Podpod n/a totaltotal 53.1% 796 / 1497 CC 248 SCAR 37.2
CC
248
Cov
50%
deprecated
169.7
deprecated
127.4
debug
101.6
CRAP 41.1
« Medley/Spawn.pm ↑ Summary Medley/Cache.pm »
1 package Util::Medley::Logger;
2 5 $Util::Medley::Logger::VERSION = '0.049';
3 5 ▶use Modern::Perl;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 5 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 5 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 5 ▶use Kavorka '-all';
Subroutine BEGIN: called CC=1 SCAR=0.0
7 5 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 5 ▶use Data::Printer alias => 'pdump';
Subroutine BEGIN: called CC=1 SCAR=0.0
9 5 ▶use FileHandle;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 5 ▶use Fcntl ":flock";
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 # in order to prevent circular deps between this and File.pm, use the
13 # originals...
14 5 ▶use File::Path 'make_path';
Subroutine BEGIN: called CC=1 SCAR=0.0
15 5 ▶use File::Basename;
Subroutine BEGIN: called CC=1 SCAR=0.0
16  
17 5 with 'Util::Medley::Roles::Attributes::DateTime';
18 5 with 'Util::Medley::Roles::Attributes::String';
19  
20 =head1 NAME
21  
22 Util::Medley::Logger - Yet another class for logging.
23  
24 =head1 VERSION
25  
26 version 0.049
27  
28 =cut
29  
30 =head1 SYNOPSIS
31  
32 my $log = Util::Medley::Logger->new;
33
34 $log->fatal($msg);
35 $log->error($msg);
36 $log->warn($msg);
37 $log->info($msg);
38 $log->verbose(Smsg);
39 $log->debug($msg);
40
41 $log->deprecated("old()", "new()");
42
43 =cut
44  
45 =head1 DESCRIPTION
46  
47 A simple logging class. By default all logs are written to stderr.
48  
49 =cut
50  
51 #########################################################################################
52  
53 5 ▶use constant LOG_LEVELS => 'debug', 'verbose', 'info', 'warn', 'error', 'fatal';
Subroutine BEGIN: called CC=1 SCAR=0.0
54 5 ▶use constant LOG_LEVEL_DEFAULT => 'info';
Subroutine BEGIN: called CC=1 SCAR=0.0
55 5 ▶use constant LOG_DETAIL_LEVEL_DEFAULT => 3;
Subroutine BEGIN: called CC=1 SCAR=0.0
56 5 ▶use constant LOG_DETAIL_LEVEL_MIN => 1;
Subroutine BEGIN: called CC=1 SCAR=0.0
57 5 ▶use constant LOG_DETAIL_LEVEL_MAX => 6;
Subroutine BEGIN: called CC=1 SCAR=0.0
58 5 ▶use constant LOG_FRAMES_DEFAULT => 2;
Subroutine BEGIN: called CC=1 SCAR=0.0
59  
60 #########################################################################################
61  
62 =head1 ATTRIBUTES
63  
64 =head2 disableStderr
65  
66 If provided and true, will disable logging messages to stderr. You should use
67 the 'filename' attribute if you provide true.
68  
69 =over
70  
71 =item type: Bool
72  
73 =item default: 0
74  
75 =back
76  
77 =cut
78  
79 5 has disableStderr => (
80 is => 'rw',
81 isa => 'Bool',
82 default => 0,
83 );
84  
85 =head2 filename
86  
87 If provided, indicates where to write log messages. This will not disable
88 stderr. To do that use disableStderr().
89  
90 Note that file locking is used when writing to a file. This allows you to
91 have multiple processes writing to the same log file without stomping on each
92 other.
93  
94 =over
95  
96 =item type: Str
97  
98 =item default: undef
99  
100 =back
101  
102 =cut
103  
104 5 has filename => (
105 is => 'rw',
106 isa => 'Str'
107 );
108  
109 =head2 logDetailLevel (<int>)
110  
111 Used to indicate how much detail to output with each message. Here is a
112 breakdown:
113  
114 1 - <msg>
115 2 - [level] <msg>
116 3 - [level] [date] <msg>
117 4 - [level] [date] [pid] <msg>
118 5 - [level] [date] [pid] [caller($frames)] <msg>
119  
120 =over
121  
122 =item type: Bool
123  
124 =item default: 3
125  
126 =item env var: MEDLEY_LOG_DETAIL_LEVEL
127  
128 =back
129  
130 =cut
131  
132 5 has logDetailLevel => (
133 is => 'rw',
134 isa => 'Int',
135 lazy => 1,
136 builder => '_getLogDetailLevel',
137 );
138  
139 =head2 logDetailLevelDebug
140  
141 Get or set the logDetailLevelDebug value. This overrides the logDetailLevel.
142  
143 =over
144  
145 =item type: Int
146  
147 =item default: undef
148  
149 =item env var: MEDLEY_LOG_DETAIL_LEVEL_DEBUG
150
151 =back
152
153 =cut
154  
155 5 has logDetailLevelDebug => (
156 is => 'rw',
157 isa => 'Int|Undef',
158 lazy => 1,
159 builder => '_buildLogDetailLevelDebug',
160 );
161  
162  
163 =head2 logDetailLevelVerbose
164  
165 Get or set the logDetailLevelVerbose value. This overrides the logDetailLevel.
166  
167 =over
168  
169 =item type: Int
170  
171 =item default: undef
172  
173 =item env var: MEDLEY_LOG_DETAIL_LEVEL_VERBOSE
174
175 =back
176
177 =cut
178  
179 5 has logDetailLevelVerbose => (
180 is => 'rw',
181 isa => 'Int|Undef',
182 lazy => 1,
183 builder => '_buildLogDetailLevelVerbose',
184 );
185  
186  
187 =head2 logDetailLevelInfo
188  
189 Get or set the logDetailLevelInfo value. This overrides the logDetailLevel.
190  
191 =over
192  
193 =item type: Int
194  
195 =item default: undef
196  
197 =item env var: MEDLEY_LOG_DETAIL_LEVEL_INFO
198
199 =back
200
201 =cut
202  
203 5 has logDetailLevelInfo => (
204 is => 'rw',
205 isa => 'Int|Undef',
206 lazy => 1,
207 builder => '_buildLogDetailLevelInfo',
208 );
209  
210  
211 =head2 logDetailLevelWarn
212  
213 Get or set the logDetailLevelWarn value. This overrides the logDetailLevel.
214  
215 =over
216  
217 =item type: Int
218  
219 =item default: undef
220  
221 =item env var: MEDLEY_LOG_DETAIL_LEVEL_WARN
222
223 =back
224
225 =cut
226  
227 5 has logDetailLevelWarn => (
228 is => 'rw',
229 isa => 'Int|Undef',
230 lazy => 1,
231 builder => '_buildLogDetailLevelWarn',
232 );
233  
234  
235 =head2 logDetailLevelError
236  
237 Get or set the logDetailLevelError value. This overrides the logDetailLevel.
238  
239 =over
240  
241 =item type: Int
242  
243 =item default: undef
244  
245 =item env var: MEDLEY_LOG_DETAIL_LEVEL_ERROR
246
247 =back
248
249 =cut
250  
251 5 has logDetailLevelError => (
252 is => 'rw',
253 isa => 'Int|Undef',
254 lazy => 1,
255 builder => '_buildLogDetailLevelError',
256 );
257  
258  
259 =head2 logDetailLevelFatal
260  
261 Get or set the logDetailLevelFatal value. This overrides the logDetailLevel.
262  
263 =over
264  
265 =item type: Int
266  
267 =item default: undef
268  
269 =item env var: MEDLEY_LOG_DETAIL_LEVEL_FATAL
270
271 =back
272
273 =cut
274  
275 5 has logDetailLevelFatal => (
276 is => 'rw',
277 isa => 'Int|Undef',
278 lazy => 1,
279 builder => '_buildLogDetailLevelFatal',
280 );
281  
282  
283 =head2 logDetailLevelDeprecated
284  
285 Get or set the logDetailLevelDeprecated value. This overrides the logDetailLevel.
286  
287 =over
288  
289 =item type: Int
290  
291 =item default: undef
292  
293 =item env var: MEDLEY_LOG_DETAIL_LEVEL_DEPRECATED
294
295 =back
296
297 =cut
298  
299 5 has logDetailLevelDeprecated => (
300 is => 'rw',
301 isa => 'Int|Undef',
302 lazy => 1,
303 builder => '_buildLogDetailLevelDeprecated',
304 );
305  
306  
307 =head2 logFrames
308  
309 Used to indicate how many frames to go back when logDetailLevel invokes the caller()
310 function. In most cases you shouldn't have to bother with this.
311  
312 =over
313  
314 =item type: Int
315  
316 =item default: 2
317  
318 =item env var: MEDLEY_LOG_FRAMES
319
320 =back
321  
322 =cut
323  
324 5 has logFrames => (
325 is => 'rw',
326 isa => 'Int',
327 lazy => 1,
328 builder => '_getLogFrames',
329 );
330  
331  
332 =head2 logLevel
333  
334 Indicates what level of log detail you want.
335  
336 Levels (in order of severity):
337  
338 - debug
339 - verbose
340 - info
341 - warn
342 - error
343 - fatal
344  
345 =over
346  
347 =item type: Str
348  
349 =item default: info
350  
351 =item env var: MEDLEY_LOG_LEVEL
352  
353 =back
354
355 =cut
356  
357 5 has logLevel => (
358 is => 'rw',
359 isa => 'Str',
360 lazy => 1,
361 builder => '_getLogLevel',
362 );
363  
364  
365 =head2 utf8
366  
367 Flag to toggle utf8 mode.
368  
369 =over
370  
371 =item type: Bool
372  
373 =item default: 0
374  
375 =back
376
377 =cut
378  
379 5 has utf8 => (
380 is => 'rw',
381 isa => 'Bool',
382 default => 0,
383 );
384  
385 #########################################################################################
386  
387 5 has _fh => (
388 is => 'rw',
389 lazy => 1,
390 builder => '_buildFh',
391 );
392  
393 5 has _logLevelMap => (
394 is => 'ro',
395 isa => 'HashRef[Int]',
396 lazy => 1,
397 builder => '_buildLogLevelMap',
398 );
399  
400 #########################################################################################
401  
402 =head1 METHODS
403  
404 =cut
405  
406 #########################################################################################
407  
408 =head2 debug
409  
410 Writes a debug message to the log.
411  
412 =over
413  
414 =item usage:
415  
416 $util->debug($msg);
417
418 $util->debug(msg => $msg);
419  
420 =item args:
421  
422 =over
423  
424 =item msg [Str]
425  
426 The message to log.
427  
428 =back
429  
430 =back
431  
432 =cut
433  
434 5 ▶multi method debug (Str $msg) {
Subroutine BEGIN: called CC=1 SCAR=0.6
Subroutine BEGIN: called CC=1 SCAR=0.6
Subroutine debug: called CC=10 SCAR=26.0
Branch: 8 branches
BranchTrueFalseTotal
ref $_[0] eq 'Kavorka::Signature::NOBBLE' ? : 300 0 300
@_ ? : 300 0 300
unless ($____nobble_checks) 0 300 300
if @_ != 1 0 300 300
$#_ >= 0 ? : 300 0 300
unless ($____nobble_checks) 0 300 300
if ($#_ >= 0) 0 0 0
Type::Tiny::XS::Str($msg) or _failed_check(9, "Str", $msg, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
435  
436 300 my $type = 'debug';
437
438 300 ▶ if ( $self->_isLogLevelEnabled($type) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->_isLogLevelEnabled($type)) 50 250 300
439
440 50 my $line = $self->_assembleMsg(
441 type => $type,
442 msg => $msg,
443 detailLevel => $self->logDetailLevelDebug,
444 );
445
446 50 $self->_printMsg($line);
447 50 return 1;
448 }
449  
450 250 return 0;
451 }
452  
453 5 ▶multi method debug (Str :$msg!) {
Subroutine BEGIN: called CC=1 SCAR=3.7
Subroutine BEGIN: called CC=1 SCAR=3.7
Subroutine BEGIN: called CC=1 SCAR=3.7
Subroutine BEGIN: called CC=1 SCAR=3.7
Subroutine BEGIN: called CC=1 SCAR=3.7
Subroutine debug: not called CC=14 SCAR=46.2
Branch: 11 branches
BranchTrueFalseTotal
ref $_[0] eq 'Kavorka::Signature::NOBBLE' ? : 0 0 0
@_ ? : 0 0 0
unless ($____nobble_checks) 0 0 0
if ($#_ == 0 and ref $_[0] eq 'HASH') { } 0 0 0
if ($slice_length % 2 != 0) 0 0 0
if ($i <= $#_) 0 0 0
$OK{$_} or Carp::croak("Unknown named parameter: $_") 0 0 0
exists $_{'msg'} ? : 0 0 0
unless ($____nobble_checks) 0 0 0
if (exists $_{"msg"}) 0 0 0
Type::Tiny::XS::Str($msg) or _failed_check(9, "Str", $msg, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
Condition0%0/3
$#_ == 0 and ref $_[0] eq "HASH"
!ll&&!rl&&r
000
MC/DC0%0/2
$#_ == 0 and ref $_[0] eq "HASH"
$#_ == 0 ref $_[0] eq "HASH"
Truth table0%0/3
A and B
A= $#_ == 0B= ref $_[0] eq "HASH"
ABresult
0X0
100
111
454  
455 0 return $self->debug($msg);
456 }
457  
458  
459 =head2 deprecated
460  
461 Writes a deprecated message to the log. First arg is the original method/sub.
462 Second arg is the new method/sub.
463  
464 =over
465  
466 =item usage:
467  
468 $util->deprecated($orig, $new);
469
470 $util->deprecated(orig => $orig, new => $new);
471  
472 =item args:
473  
474 =over
475  
476 =item orig [Str]
477  
478 Name of the deprecated method.
479  
480 =item new [Str]
481  
482 Name of the new method.
483  
484 =back
485  
486 =back
487  
488 =cut
489  
490 5 ▶multi method deprecated (Str $orig, Str $new) {
Subroutine BEGIN: called CC=1 SCAR=4.2
Subroutine BEGIN: called CC=1 SCAR=4.2
Subroutine BEGIN: called CC=1 SCAR=4.2
Subroutine deprecated: not called CC=14 SCAR=48.5
Branch: 12 branches
BranchTrueFalseTotal
ref $_[0] eq 'Kavorka::Signature::NOBBLE' ? : 0 0 0
@_ ? : 0 0 0
unless ($____nobble_checks) 0 0 0
if @_ != 2 0 0 0
$#_ >= 0 ? : 0 0 0
unless ($____nobble_checks) 0 0 0
if ($#_ >= 0) 0 0 0
Type::Tiny::XS::Str($orig) or _failed_check(9, "Str", $orig, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
$#_ >= 1 ? : 0 0 0
unless ($____nobble_checks) 0 0 0
if ($#_ >= 1) 0 0 0
Type::Tiny::XS::Str($new) or _failed_check(9, "Str", $new, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
491  
492 0 ▶ if ( $self->_isLogLevelEnabled('warn') ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->_isLogLevelEnabled("warn")) 0 0 0
493  
494 0 my $msg = sprintf "%s is deprecated by %s.\n", $orig, $new;
495  
496 0 my $line = $self->_assembleMsg(
497 type => 'deprecated',
498 msg => $msg,
499 );
500  
501 0 $self->_printMsg($line);
502 0 return 1;
503 }
504  
505 0 return 0;
506 }
507  
508 5 ▶multi method deprecated (Str :$orig!, Str :$new!) {
Subroutine BEGIN: called CC=1 SCAR=3.8
Subroutine BEGIN: called CC=1 SCAR=3.8
Subroutine BEGIN: called CC=1 SCAR=3.8
Subroutine BEGIN: called CC=1 SCAR=3.8
Subroutine BEGIN: called CC=1 SCAR=3.8
Subroutine BEGIN: called CC=1 SCAR=3.8
Subroutine deprecated: not called CC=18 SCAR=51.3
Branch: 15 branches
BranchTrueFalseTotal
ref $_[0] eq 'Kavorka::Signature::NOBBLE' ? : 0 0 0
@_ ? : 0 0 0
unless ($____nobble_checks) 0 0 0
if ($#_ == 0 and ref $_[0] eq 'HASH') { } 0 0 0
if ($slice_length % 2 != 0) 0 0 0
if ($i <= $#_) 0 0 0
$OK{$_} or Carp::croak("Unknown named parameter: $_") 0 0 0
exists $_{'orig'} ? : 0 0 0
unless ($____nobble_checks) 0 0 0
if (exists $_{"orig"}) 0 0 0
Type::Tiny::XS::Str($orig) or _failed_check(9, "Str", $orig, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'new'} ? : 0 0 0
unless ($____nobble_checks) 0 0 0
if (exists $_{"new"}) 0 0 0
Type::Tiny::XS::Str($new) or _failed_check(9, "Str", $new, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
Condition0%0/3
$#_ == 0 and ref $_[0] eq "HASH"
!ll&&!rl&&r
000
MC/DC0%0/2
$#_ == 0 and ref $_[0] eq "HASH"
$#_ == 0 ref $_[0] eq "HASH"
Truth table0%0/3
A and B
A= $#_ == 0B= ref $_[0] eq "HASH"
ABresult
0X0
100
111
509  
510 0 return $self->deprecated($orig, $new);
511 }
512  
513  
514 =head2 error
515  
516 Writes an error message to the log.
517  
518 =over
519  
520 =item usage:
521  
522 $util->error($msg);
523
524 $util->error(msg => $msg);
525  
526 =item args:
527  
528 =over
529  
530 =item msg [Str]
531  
532 The message to log.
533  
534 =back
535  
536 =back
537  
538 =cut
539  
540 5 ▶multi method error (Str $msg) {
Subroutine BEGIN: called CC=1 SCAR=0.6
Subroutine BEGIN: called CC=1 SCAR=0.6
Subroutine error: called CC=10 SCAR=26.0
Branch: 8 branches
BranchTrueFalseTotal
ref $_[0] eq 'Kavorka::Signature::NOBBLE' ? : 300 0 300
@_ ? : 300 0 300
unless ($____nobble_checks) 0 300 300
if @_ != 1 0 300 300
$#_ >= 0 ? : 300 0 300
unless ($____nobble_checks) 0 300 300
if ($#_ >= 0) 0 0 0
Type::Tiny::XS::Str($msg) or _failed_check(9, "Str", $msg, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
541  
542 300 my $type = 'error';
543  
544 300 ▶ if ( $self->_isLogLevelEnabled($type) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->_isLogLevelEnabled($type)) 250 50 300
545  
546 250 my $line = $self->_assembleMsg(
547 type => $type,
548 msg => $msg,
549 );
550  
551 250 $self->_printMsg($line);
552 250 return 1;
553 }
554  
555 50 return 0;
556 }
557  
558 5 ▶multi method error (Str :$msg!) {
Subroutine BEGIN: called CC=1 SCAR=3.7
Subroutine BEGIN: called CC=1 SCAR=3.7
Subroutine BEGIN: called CC=1 SCAR=3.7
Subroutine BEGIN: called CC=1 SCAR=3.7
Subroutine BEGIN: called CC=1 SCAR=3.7
Subroutine error: not called CC=14 SCAR=46.2
Branch: 11 branches
BranchTrueFalseTotal
ref $_[0] eq 'Kavorka::Signature::NOBBLE' ? : 0 0 0
@_ ? : 0 0 0
unless ($____nobble_checks) 0 0 0
if ($#_ == 0 and ref $_[0] eq 'HASH') { } 0 0 0
if ($slice_length % 2 != 0) 0 0 0
if ($i <= $#_) 0 0 0
$OK{$_} or Carp::croak("Unknown named parameter: $_") 0 0 0
exists $_{'msg'} ? : 0 0 0
unless ($____nobble_checks) 0 0 0
if (exists $_{"msg"}) 0 0 0
Type::Tiny::XS::Str($msg) or _failed_check(9, "Str", $msg, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
Condition0%0/3
$#_ == 0 and ref $_[0] eq "HASH"
!ll&&!rl&&r
000
MC/DC0%0/2
$#_ == 0 and ref $_[0] eq "HASH"
$#_ == 0 ref $_[0] eq "HASH"
Truth table0%0/3
A and B
A= $#_ == 0B= ref $_[0] eq "HASH"
ABresult
0X0
100
111
559  
560 0 return $self->error($msg);
561 }
562  
563  
564 =head2 fatal
565  
566 Writes a fatal message to the log and exits with 1.
567  
568 =over
569  
570 =item usage:
571  
572 $util->fatal($msg);
573
574 $util->fatal(msg => $msg);
575  
576 =item args:
577  
578 =over
579  
580 =item msg [Str]
581  
582 The message to log.
583  
584 =back
585  
586 =back
587  
588 =cut
589  
590 5 ▶multi method fatal (Str $msg) {
Subroutine BEGIN: called CC=1 SCAR=0.6
Subroutine BEGIN: called CC=1 SCAR=0.6
Subroutine fatal: called CC=9 SCAR=25.5
Branch: 8 branches
BranchTrueFalseTotal
ref $_[0] eq 'Kavorka::Signature::NOBBLE' ? : 1 0 1
@_ ? : 1 0 1
unless ($____nobble_checks) 0 1 1
if @_ != 1 0 1 1
$#_ >= 0 ? : 1 0 1
unless ($____nobble_checks) 0 1 1
if ($#_ >= 0) 0 0 0
Type::Tiny::XS::Str($msg) or _failed_check(9, "Str", $msg, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
591  
592 1 my $type = 'fatal';
593
594 1 my $line = $self->_assembleMsg(
595 type => $type,
596 msg => $msg,
597 );
598  
599 1 $self->_printMsg($line);
600 1 exit 1;
601 }
602  
603 5 ▶multi method fatal (Str :$msg!) {
Subroutine BEGIN: called CC=1 SCAR=3.7
Subroutine BEGIN: called CC=1 SCAR=3.7
Subroutine BEGIN: called CC=1 SCAR=3.7
Subroutine BEGIN: called CC=1 SCAR=3.7
Subroutine BEGIN: called CC=1 SCAR=3.7
Subroutine fatal: not called CC=14 SCAR=46.2
Branch: 11 branches
BranchTrueFalseTotal
ref $_[0] eq 'Kavorka::Signature::NOBBLE' ? : 0 0 0
@_ ? : 0 0 0
unless ($____nobble_checks) 0 0 0
if ($#_ == 0 and ref $_[0] eq 'HASH') { } 0 0 0
if ($slice_length % 2 != 0) 0 0 0
if ($i <= $#_) 0 0 0
$OK{$_} or Carp::croak("Unknown named parameter: $_") 0 0 0
exists $_{'msg'} ? : 0 0 0
unless ($____nobble_checks) 0 0 0
if (exists $_{"msg"}) 0 0 0
Type::Tiny::XS::Str($msg) or _failed_check(9, "Str", $msg, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
Condition0%0/3
$#_ == 0 and ref $_[0] eq "HASH"
!ll&&!rl&&r
000
MC/DC0%0/2
$#_ == 0 and ref $_[0] eq "HASH"
$#_ == 0 ref $_[0] eq "HASH"
Truth table0%0/3
A and B
A= $#_ == 0B= ref $_[0] eq "HASH"
ABresult
0X0
100
111
604  
605 0 $self->fatal($msg);
606 }
607  
608  
609 =head2 getLogLevels
610  
611 Returns an array of all possible levels in severity order.
612  
613 =over
614  
615 =item usage:
616  
617 @levels = $util->getLogLevels;
618
619 =back
620  
621 =cut
622  
623 5 ▶method getLogLevels {
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine getLogLevels: called CC=2 SCAR=7.0
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 12 0 12
624
625 12 return LOG_LEVELS();
626 }
627  
628  
629 =head2 info
630  
631 Writes an info message to the log.
632  
633 =over
634  
635 =item usage:
636  
637 $util->info($msg);
638
639 $util->info(msg => $msg);
640  
641 =item args:
642  
643 =over
644  
645 =item msg [Str]
646  
647 The message to log.
648  
649 =back
650  
651 =back
652  
653 =cut
654  
655 5 ▶multi method info (Str $msg) {
Subroutine BEGIN: called CC=1 SCAR=0.6
Subroutine BEGIN: called CC=1 SCAR=0.6
Subroutine info: called CC=10 SCAR=26.0
Branch: 8 branches
BranchTrueFalseTotal
ref $_[0] eq 'Kavorka::Signature::NOBBLE' ? : 300 0 300
@_ ? : 300 0 300
unless ($____nobble_checks) 0 300 300
if @_ != 1 0 300 300
$#_ >= 0 ? : 300 0 300
unless ($____nobble_checks) 0 300 300
if ($#_ >= 0) 0 0 0
Type::Tiny::XS::Str($msg) or _failed_check(9, "Str", $msg, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
656  
657 300 my $type = 'info';
658  
659 300 ▶ if ( $self->_isLogLevelEnabled($type) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->_isLogLevelEnabled($type)) 150 150 300
660  
661 150 my $line = $self->_assembleMsg(
662 type => $type,
663 msg => $msg,
664 );
665  
666 150 $self->_printMsg($line);
667 150 return 1;
668 }
669  
670 150 return 0;
671 }
672  
673 5 ▶multi method info (Str :$msg!) {
Subroutine BEGIN: called CC=1 SCAR=3.7
Subroutine BEGIN: called CC=1 SCAR=3.7
Subroutine BEGIN: called CC=1 SCAR=3.7
Subroutine BEGIN: called CC=1 SCAR=3.7
Subroutine BEGIN: called CC=1 SCAR=3.7
Subroutine info: not called CC=14 SCAR=46.2
Branch: 11 branches
BranchTrueFalseTotal
ref $_[0] eq 'Kavorka::Signature::NOBBLE' ? : 0 0 0
@_ ? : 0 0 0
unless ($____nobble_checks) 0 0 0
if ($#_ == 0 and ref $_[0] eq 'HASH') { } 0 0 0
if ($slice_length % 2 != 0) 0 0 0
if ($i <= $#_) 0 0 0
$OK{$_} or Carp::croak("Unknown named parameter: $_") 0 0 0
exists $_{'msg'} ? : 0 0 0
unless ($____nobble_checks) 0 0 0
if (exists $_{"msg"}) 0 0 0
Type::Tiny::XS::Str($msg) or _failed_check(9, "Str", $msg, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
Condition0%0/3
$#_ == 0 and ref $_[0] eq "HASH"
!ll&&!rl&&r
000
MC/DC0%0/2
$#_ == 0 and ref $_[0] eq "HASH"
$#_ == 0 ref $_[0] eq "HASH"
Truth table0%0/3
A and B
A= $#_ == 0B= ref $_[0] eq "HASH"
ABresult
0X0
100
111
674  
675 0 return $self->info($msg);
676 }
677  
678  
679 =head2 verbose
680  
681 Writes a verbose message to the log.
682  
683 =over
684  
685 =item usage:
686  
687 $util->verbose($msg);
688
689 $util->verbose(msg => $msg);
690  
691 =item args:
692  
693 =over
694  
695 =item msg [Str]
696  
697 The message to log.
698  
699 =back
700  
701 =back
702  
703 =cut
704  
705 5 ▶multi method verbose (Str $msg) {
Subroutine BEGIN: called CC=1 SCAR=0.6
Subroutine BEGIN: called CC=1 SCAR=0.6
Subroutine verbose: called CC=10 SCAR=26.0
Branch: 8 branches
BranchTrueFalseTotal
ref $_[0] eq 'Kavorka::Signature::NOBBLE' ? : 350 0 350
@_ ? : 350 0 350
unless ($____nobble_checks) 0 350 350
if @_ != 1 0 350 350
$#_ >= 0 ? : 350 0 350
unless ($____nobble_checks) 0 350 350
if ($#_ >= 0) 0 0 0
Type::Tiny::XS::Str($msg) or _failed_check(9, "Str", $msg, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
706  
707 350 my $type = 'verbose';
708  
709 350 ▶ if ( $self->_isLogLevelEnabled($type) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->_isLogLevelEnabled($type)) 100 250 350
710  
711 100 my $line = $self->_assembleMsg(
712 type => $type,
713 msg => $msg,
714 );
715  
716 100 $self->_printMsg($line);
717 100 return 1;
718 }
719  
720 250 return 0;
721 }
722  
723 5 ▶multi method verbose (Str :$msg!) {
Subroutine BEGIN: called CC=1 SCAR=3.7
Subroutine BEGIN: called CC=1 SCAR=3.7
Subroutine BEGIN: called CC=1 SCAR=3.7
Subroutine BEGIN: called CC=1 SCAR=3.7
Subroutine BEGIN: called CC=1 SCAR=3.7
Subroutine verbose: not called CC=14 SCAR=46.2
Branch: 11 branches
BranchTrueFalseTotal
ref $_[0] eq 'Kavorka::Signature::NOBBLE' ? : 0 0 0
@_ ? : 0 0 0
unless ($____nobble_checks) 0 0 0
if ($#_ == 0 and ref $_[0] eq 'HASH') { } 0 0 0
if ($slice_length % 2 != 0) 0 0 0
if ($i <= $#_) 0 0 0
$OK{$_} or Carp::croak("Unknown named parameter: $_") 0 0 0
exists $_{'msg'} ? : 0 0 0
unless ($____nobble_checks) 0 0 0
if (exists $_{"msg"}) 0 0 0
Type::Tiny::XS::Str($msg) or _failed_check(9, "Str", $msg, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
Condition0%0/3
$#_ == 0 and ref $_[0] eq "HASH"
!ll&&!rl&&r
000
MC/DC0%0/2
$#_ == 0 and ref $_[0] eq "HASH"
$#_ == 0 ref $_[0] eq "HASH"
Truth table0%0/3
A and B
A= $#_ == 0B= ref $_[0] eq "HASH"
ABresult
0X0
100
111
724  
725 0 return $self->verbose($msg);
726 }
727  
728  
729 =head2 warn
730  
731 Writes a warn message to the log.
732  
733 =over
734  
735 =item usage:
736  
737 $util->warn($msg);
738
739 $util->warn(msg => $msg);
740  
741 =item args:
742  
743 =over
744  
745 =item msg [Str]
746  
747 The message to log.
748  
749 =back
750  
751 =back
752  
753 =cut
754  
755 5 ▶multi method warn (Str $msg) {
Subroutine BEGIN: called CC=1 SCAR=0.6
Subroutine BEGIN: called CC=1 SCAR=0.6
Subroutine warn: called CC=10 SCAR=26.0
Branch: 8 branches
BranchTrueFalseTotal
ref $_[0] eq 'Kavorka::Signature::NOBBLE' ? : 300 0 300
@_ ? : 300 0 300
unless ($____nobble_checks) 0 300 300
if @_ != 1 0 300 300
$#_ >= 0 ? : 300 0 300
unless ($____nobble_checks) 0 300 300
if ($#_ >= 0) 0 0 0
Type::Tiny::XS::Str($msg) or _failed_check(9, "Str", $msg, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
756  
757 300 my $type = 'warn';
758  
759 300 ▶ if ( $self->_isLogLevelEnabled($type) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->_isLogLevelEnabled($type)) 200 100 300
760  
761 200 my $line = $self->_assembleMsg(
762 type => $type,
763 msg => $msg,
764 );
765  
766 200 $self->_printMsg($line);
767 200 return 1;
768 }
769  
770 100 return 0;
771 }
772  
773 5 ▶multi method warn (Str :$msg!) {
Subroutine BEGIN: called CC=1 SCAR=3.7
Subroutine BEGIN: called CC=1 SCAR=3.7
Subroutine BEGIN: called CC=1 SCAR=3.7
Subroutine BEGIN: called CC=1 SCAR=3.7
Subroutine BEGIN: called CC=1 SCAR=3.7
Subroutine warn: not called CC=14 SCAR=46.2
Branch: 11 branches
BranchTrueFalseTotal
ref $_[0] eq 'Kavorka::Signature::NOBBLE' ? : 0 0 0
@_ ? : 0 0 0
unless ($____nobble_checks) 0 0 0
if ($#_ == 0 and ref $_[0] eq 'HASH') { } 0 0 0
if ($slice_length % 2 != 0) 0 0 0
if ($i <= $#_) 0 0 0
$OK{$_} or Carp::croak("Unknown named parameter: $_") 0 0 0
exists $_{'msg'} ? : 0 0 0
unless ($____nobble_checks) 0 0 0
if (exists $_{"msg"}) 0 0 0
Type::Tiny::XS::Str($msg) or _failed_check(9, "Str", $msg, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
Condition0%0/3
$#_ == 0 and ref $_[0] eq "HASH"
!ll&&!rl&&r
000
MC/DC0%0/2
$#_ == 0 and ref $_[0] eq "HASH"
$#_ == 0 ref $_[0] eq "HASH"
Truth table0%0/3
A and B
A= $#_ == 0B= ref $_[0] eq "HASH"
ABresult
0X0
100
111
774  
775 0 return $self->warn($msg);
776 }
777  
778 ######################################################################
779  
780 5 ▶method _printMsg (Str $line) {
Subroutine BEGIN: called CC=1 SCAR=0.1
Subroutine BEGIN: called CC=1 SCAR=0.1
Subroutine _printMsg: called CC=8 SCAR=22.9
Branch: 5 branches
BranchTrueFalseTotal
@_ ? : 751 0 751
if @_ != 1 0 751 751
$#_ >= 0 ? : 751 0 751
if ($#_ >= 0) 751 0 751
Type::Tiny::XS::Str($line) or _failed_check(9, "Str", $line, "exception_class", "Error::TypeTiny::Assertion") 0 751 751
781  
782 751 ▶ if (!$self->disableStderr) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->disableStderr) 751 0 751
783 751 print STDERR "$line\n";
784 }
785
786 751 ▶ if ($self->filename) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->filename) 0 751 751
787 0 my $fh = $self->_fh;
788 0 flock($fh, LOCK_EX);
789 0 print $fh "$line\n";
790 0 flock($fh, LOCK_UN);
791 }
792 }
793  
794 method _assembleMsg (Str :$type!,
795 Str :$msg!,
796 5 ▶ Int|Undef :$detailLevel) {
Subroutine BEGIN: called CC=1 SCAR=0.1
Subroutine BEGIN: called CC=1 SCAR=0.1
Subroutine BEGIN: called CC=1 SCAR=0.1
Subroutine BEGIN: called CC=1 SCAR=0.1
Subroutine BEGIN: called CC=1 SCAR=0.1
Subroutine BEGIN: called CC=1 SCAR=0.1
Subroutine BEGIN: called CC=1 SCAR=0.1
Subroutine _assembleMsg: called CC=23 SCAR=32.3
Branch: 14 branches
BranchTrueFalseTotal
@_ ? : 751 0 751
if ($#_ == 0 and ref $_[0] eq 'HASH') { } 0 751 751
if ($slice_length % 2 != 0) 0 751 751
if ($i <= $#_) 1552 751 2303
$OK{$_} or Carp::croak("Unknown named parameter: $_") 0 1552 1552
exists $_{'type'} ? : 751 0 751
if (exists $_{"type"}) 751 0 751
Type::Tiny::XS::Str($type) or _failed_check(9, "Str", $type, "exception_class", "Error::TypeTiny::Assertion") 0 751 751
exists $_{'msg'} ? : 751 0 751
if (exists $_{"msg"}) 751 0 751
Type::Tiny::XS::Str($msg) or _failed_check(9, "Str", $msg, "exception_class", "Error::TypeTiny::Assertion") 0 751 751
exists $_{'detailLevel'} ? : 50 701 751
if (exists $_{"detailLevel"}) 50 701 751
Type::Tiny::XS::AUTO::TC2($detailLevel) or _failed_check(46, "Int|Undef", $detailLevel, "exception_class", "Error::TypeTiny::Assertion") 0 50 50
Condition33%1/3
$#_ == 0 and ref $_[0] eq "HASH"
!ll&&!rl&&r
75100
MC/DC0%0/2
$#_ == 0 and ref $_[0] eq "HASH"
$#_ == 0 ref $_[0] eq "HASH"
Truth table33%1/3
A and B
A= $#_ == 0B= ref $_[0] eq "HASH"
ABresult
0X0
100
111
797  
798 751 my $frames = $self->logFrames;
799 751 ▶ my $detail = $self->logDetailLevel if !$detailLevel;
Branch: 1 branch
BranchTrueFalseTotal
unless $detailLevel 751 0 751
800 751 my @msg;
801
802 751 ▶ if ( $detail > 1 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($detail > 1) 601 150 751
803 601 push @msg, uc "[$type]";
804 }
805  
806 751 ▶ if ( $detail > 2 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($detail > 2) 451 300 751
807 451 push @msg, sprintf '[%s]', $self->DateTime->localDateTime();
808 }
809  
810 751 ▶ if ( $detail > 3 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($detail > 3) 300 451 751
811 300 push @msg, sprintf '[%d]', $$;
812 }
813  
814 751 ▶ if ( $detail > 4 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($detail > 4) 150 601 751
815 150 push @msg, sprintf '[%s]', ( caller($frames) )[3];
816 }
817  
818 751 ▶ if ( $detail > 5 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($detail > 5) 0 751 751
819 0 push @msg, sprintf '[line %d]', ( caller($frames) )[2];
820 }
821  
822 751 push @msg, $self->String->trim($msg);
823  
824 751 return join( ' ', @msg );
825 }
826  
827 5 ▶method _getLogDetailLevel () {
Subroutine BEGIN: called CC=1 SCAR=0.1
Subroutine _getLogDetailLevel: called CC=4 SCAR=14.2
Branch: 2 branches
BranchTrueFalseTotal
@_ ? : 1 0 1
if @_ != 0 0 1 1
828  
829 1 my $detail;
830 1 ▶ if ( $ENV{MEDLEY_LOG_DETAIL_LEVEL} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ENV{'MEDLEY_LOG_DETAIL_LEVEL'}) { } 0 1 1
831 0 $detail = $ENV{MEDLEY_LOG_DETAIL_LEVEL};
832 }
833 else {
834 1 $detail = LOG_DETAIL_LEVEL_DEFAULT();
835 }
836  
837 1 $self->_isLogDetailLevelValid($detail);
838  
839 1 return $detail;
840 }
841  
842 5 ▶method _getLogLevel () {
Subroutine BEGIN: called CC=1 SCAR=0.1
Subroutine _getLogLevel: called CC=7 SCAR=22.2
Branch: 2 branches
BranchTrueFalseTotal
@_ ? : 15 0 15
if @_ != 0 0 15 15
843  
844 15 my $level;
845 15 ▶ if ( $ENV{MEDLEY_DEBUG} ) {
Branch: 3 branches
BranchTrueFalseTotal
if ($ENV{'MEDLEY_DEBUG'}) { } 0 15 15
elsif ($ENV{'MEDLEY_VERBOSE'}) { } 0 15 15
elsif ($ENV{'MEDLEY_LOG_LEVEL'}) { } 0 15 15
846 0 $level = 'debug';
847 }
848 elsif ( $ENV{MEDLEY_VERBOSE} ) {
849 0 $level = 'verbose';
850 }
851 elsif ( $ENV{MEDLEY_LOG_LEVEL} ) {
852 0 $level = $ENV{MEDLEY_LOG_LEVEL};
853 }
854 else {
855 15 $level = LOG_LEVEL_DEFAULT();
856 }
857  
858 15 ▶ if ( !$self->_isLogLevelValid($level) ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->_isLogLevelValid($level)) 0 15 15
859 0 confess "log level $level is invalid";
860 }
861  
862 15 return $level;
863 }
864  
865 5 ▶method _isLogLevelValid (Str $level) {
Subroutine BEGIN: called CC=1 SCAR=0.1
Subroutine BEGIN: called CC=1 SCAR=0.1
Subroutine _isLogLevelValid: called CC=7 SCAR=20.3
Branch: 5 branches
BranchTrueFalseTotal
@_ ? : 15 0 15
if @_ != 1 0 15 15
$#_ >= 0 ? : 15 0 15
if ($#_ >= 0) 15 0 15
Type::Tiny::XS::Str($level) or _failed_check(9, "Str", $level, "exception_class", "Error::TypeTiny::Assertion") 0 15 15
866  
867 15 ▶ if ( defined $self->_logLevelMap->{$level} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->_logLevelMap->{$level}) 15 0 15
868 15 return 1;
869 }
870  
871 0 return 0;
872 }
873  
874 5 ▶method _isLogDetailLevelValid (Int $detail) {
Subroutine BEGIN: called CC=1 SCAR=0.1
Subroutine BEGIN: called CC=1 SCAR=0.1
Subroutine _isLogDetailLevelValid: called CC=8 SCAR=21.9
Branch: 5 branches
BranchTrueFalseTotal
@_ ? : 1 0 1
if @_ != 1 0 1 1
$#_ >= 0 ? : 1 0 1
if ($#_ >= 0) 1 0 1
Type::Tiny::XS::Int($detail) or _failed_check(13, "Int", $detail, "exception_class", "Error::TypeTiny::Assertion") 0 1 1
875  
876 1 ▶ if ( $detail >= LOG_DETAIL_LEVEL_MIN() ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($detail >= 1) 1 0 1
877 1 ▶ if ( $detail <= LOG_DETAIL_LEVEL_MAX() ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($detail <= 6) 1 0 1
878 1 return 1;
879 }
880 }
881  
882 0 confess "invalid logDetailLevel $detail";
883 }
884  
885 5 ▶method _isLogLevelEnabled (Str $level) {
Subroutine BEGIN: called CC=1 SCAR=0.1
Subroutine BEGIN: called CC=1 SCAR=0.1
Subroutine _isLogLevelEnabled: called CC=7 SCAR=19.7
Branch: 5 branches
BranchTrueFalseTotal
@_ ? : 1550 0 1550
if @_ != 1 0 1550 1550
$#_ >= 0 ? : 1550 0 1550
if ($#_ >= 0) 1550 0 1550
Type::Tiny::XS::Str($level) or _failed_check(9, "Str", $level, "exception_class", "Error::TypeTiny::Assertion") 0 1550 1550
886  
887 1550 my $cutoff = $self->_logLevelToInt( $self->logLevel );
888 1550 my $want = $self->_logLevelToInt($level);
889
890 1550 ▶ if ( $cutoff <= $want ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($cutoff <= $want) 750 800 1550
891 750 return 1;
892 }
893  
894 800 return 0;
895 }
896  
897 5 ▶method _logLevelToInt (Str $level) {
Subroutine BEGIN: called CC=1 SCAR=0.1
Subroutine BEGIN: called CC=1 SCAR=0.1
Subroutine _logLevelToInt: called CC=7 SCAR=20.3
Branch: 5 branches
BranchTrueFalseTotal
@_ ? : 6100 0 6100
if @_ != 1 0 6100 6100
$#_ >= 0 ? : 6100 0 6100
if ($#_ >= 0) 6100 0 6100
Type::Tiny::XS::Str($level) or _failed_check(9, "Str", $level, "exception_class", "Error::TypeTiny::Assertion") 0 6100 6100
898
899 6100 ▶ if(defined $self->_logLevelMap->{$level} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->_logLevelMap->{$level}) 6100 0 6100
900 6100 return $self->_logLevelMap->{$level}
901 }
902
903 0 confess "unknown log level: $level";
904 }
905  
906 5 ▶method _getLogFrames {
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine _getLogFrames: called CC=3 SCAR=11.3
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 751 0 751
907  
908 751 my $frames = LOG_FRAMES_DEFAULT() => 1;
909 751 ▶ if ( $ENV{MEDLEY_LOG_FRAMES} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ENV{"MEDLEY_LOG_FRAMES"}) 0 751 751
910 0 $frames = $ENV{MEDLEY_LOG_FRAMES};
911 }
912  
913 751 return $frames;
914 }
915  
916 5 ▶method _buildLogLevelMap {
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine _buildLogLevelMap: called CC=3 SCAR=11.0
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 1515 0 1515
917  
918 1515 my $i = 0;
919 1515 my %map;
920 1515 foreach my $level ( LOG_LEVELS() ) {
921 9090 $map{$level} = $i;
922 9090 $i++;
923 }
924  
925 1515 return \%map;
926 }
927  
928 5 ▶method _buildFh {
Subroutine BEGIN: called CC=1 SCAR=1.2
Subroutine _buildFh: not called CC=5 SCAR=29.3
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 0 0 0
929  
930 0 ▶ if ($self->filename) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->filename) 0 0 0
931
932 0 my $filename = $self->filename;
933 0 make_path(dirname($filename));
934
935 # append - all writes automatically go to the end of the file when
936 # writing
937 0 ▶ my $fh = FileHandle->new(">>$filename") or
Branch: 1 branch
BranchTrueFalseTotal
my $fh = "FileHandle"->new(">>$filename") or confess("could not open ${filename}: $!") 0 0 0
938 confess "could not open $filename: $!";
939
940 0 $fh->autoflush(1);
941
942 0 ▶ if( $self->utf8 ){
Branch: 1 branch
BranchTrueFalseTotal
if ($self->utf8) 0 0 0
943 0 binmode( $fh, ":utf8" );
944 }
945
946 0 return $fh;
947 }
948 }
949  
950 5 ▶method _buildLogDetailLevelDebug {
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine _buildLogDetailLevelDebug: called CC=3 SCAR=12.3
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 50 0 50
951  
952 50 ▶ if ($ENV{MEDLEY_LOG_DETAIL_LEVEL_DEBUG}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ENV{"MEDLEY_LOG_DETAIL_LEVEL_DEBUG"}) 0 50 50
953 0 my $level = $ENV{MEDLEY_LOG_DETAIL_LEVEL_DEBUG};
954 0 $self->_isLogDetailLevelValid($level);
955 0 return $level;
956 }
957 }
958  
959 5 ▶method _buildLogDetailLevelVerbose {
Subroutine BEGIN: called CC=1 SCAR=1.2
Subroutine _buildLogDetailLevelVerbose: not called CC=3 SCAR=18.4
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 0 0 0
960  
961 0 ▶ if ($ENV{MEDLEY_LOG_DETAIL_LEVEL_VERBOSE}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ENV{"MEDLEY_LOG_DETAIL_LEVEL_VERBOSE"}) 0 0 0
962 0 my $level = $ENV{MEDLEY_LOG_DETAIL_LEVEL_VERBOSE};
963 0 $self->_isLogDetailLevelValid($level);
964 0 return $level;
965 }
966 }
967  
968 5 ▶method _buildLogDetailLevelInfo {
Subroutine BEGIN: called CC=1 SCAR=1.2
Subroutine _buildLogDetailLevelInfo: not called CC=3 SCAR=18.4
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 0 0 0
969  
970 0 ▶ if ($ENV{MEDLEY_LOG_DETAIL_LEVEL_INFO}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ENV{"MEDLEY_LOG_DETAIL_LEVEL_INFO"}) 0 0 0
971 0 my $level = $ENV{MEDLEY_LOG_DETAIL_LEVEL_INFO};
972 0 $self->_isLogDetailLevelValid($level);
973 0 return $level;
974 }
975 }
976  
977 5 ▶method _buildLogDetailLevelWarn {
Subroutine BEGIN: called CC=1 SCAR=1.2
Subroutine _buildLogDetailLevelWarn: not called CC=3 SCAR=18.4
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 0 0 0
978  
979 0 ▶ if ($ENV{MEDLEY_LOG_DETAIL_LEVEL_WARN}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ENV{"MEDLEY_LOG_DETAIL_LEVEL_WARN"}) 0 0 0
980 0 my $level = $ENV{MEDLEY_LOG_DETAIL_LEVEL_WARN};
981 0 $self->_isLogDetailLevelValid($level);
982 0 return $level;
983 }
984 }
985  
986 5 ▶method _buildLogDetailLevelError {
Subroutine BEGIN: called CC=1 SCAR=1.2
Subroutine _buildLogDetailLevelError: not called CC=3 SCAR=18.4
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 0 0 0
987  
988 0 ▶ if ($ENV{MEDLEY_LOG_DETAIL_LEVEL_ERROR}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ENV{"MEDLEY_LOG_DETAIL_LEVEL_ERROR"}) 0 0 0
989 0 my $level = $ENV{MEDLEY_LOG_DETAIL_LEVEL_ERROR};
990 0 $self->_isLogDetailLevelValid($level);
991 0 return $level;
992 }
993 }
994  
995 5 ▶method _buildLogDetailLevelFatal {
Subroutine BEGIN: called CC=1 SCAR=1.2
Subroutine _buildLogDetailLevelFatal: not called CC=3 SCAR=18.4
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 0 0 0
996  
997 0 ▶ if ($ENV{MEDLEY_LOG_DETAIL_LEVEL_FATAL}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ENV{"MEDLEY_LOG_DETAIL_LEVEL_FATAL"}) 0 0 0
998 0 my $level = $ENV{MEDLEY_LOG_DETAIL_LEVEL_FATAL};
999 0 $self->_isLogDetailLevelValid($level);
1000 0 return $level;
1001 }
1002 }
1003  
1004 5 ▶method _buildLogDetailLevelDeprecated {
Subroutine BEGIN: called CC=1 SCAR=1.2
Subroutine _buildLogDetailLevelDeprecated: not called CC=3 SCAR=18.4
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 0 0 0
1005  
1006 0 ▶ if ($ENV{MEDLEY_LOG_DETAIL_LEVEL_DEPRECATED}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ENV{"MEDLEY_LOG_DETAIL_LEVEL_DEPRECATED"}) 0 0 0
1007 0 my $level = $ENV{MEDLEY_LOG_DETAIL_LEVEL_DEPRECATED};
1008 0 $self->_isLogDetailLevelValid($level);
1009 0 return $level;
1010 }
1011 }
1012  
1013 5 1;
« Medley/Spawn.pm ↑ Summary Medley/Cache.pm »