line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Cinnamon::Logger; |
2
|
3
|
|
|
3
|
|
13
|
use strict; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
72
|
|
3
|
3
|
|
|
3
|
|
14
|
use warnings; |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
76
|
|
4
|
3
|
|
|
3
|
|
14
|
use parent qw(Exporter); |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
16
|
|
5
|
|
|
|
|
|
|
|
6
|
3
|
|
|
3
|
|
98023
|
use Term::ANSIColor (); |
|
3
|
|
|
|
|
27526
|
|
|
3
|
|
|
|
|
522
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our @EXPORT = qw( |
9
|
|
|
|
|
|
|
log |
10
|
|
|
|
|
|
|
); |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
my %COLOR = ( |
13
|
|
|
|
|
|
|
success => 'green', |
14
|
|
|
|
|
|
|
error => 'red', |
15
|
|
|
|
|
|
|
info => 'white', |
16
|
|
|
|
|
|
|
); |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub log ($$) { |
19
|
0
|
|
|
0
|
0
|
|
my ($type, $message) = @_; |
20
|
0
|
|
0
|
|
|
|
my $color ||= $COLOR{$type}; |
21
|
|
|
|
|
|
|
|
22
|
0
|
0
|
|
|
|
|
$message = Term::ANSIColor::colored $message, $color if $color; |
23
|
0
|
|
|
|
|
|
$message .= "\n"; |
24
|
|
|
|
|
|
|
|
25
|
0
|
0
|
|
|
|
|
my $fh = $type eq 'error' ? *STDERR : *STDOUT; |
26
|
|
|
|
|
|
|
|
27
|
0
|
|
|
|
|
|
print $fh $message; |
28
|
|
|
|
|
|
|
|
29
|
0
|
|
|
|
|
|
return; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
!!1; |