line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Cinnamon::Logger; |
2
|
3
|
|
|
3
|
|
14
|
use strict; |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
108
|
|
3
|
3
|
|
|
3
|
|
12
|
use warnings; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
82
|
|
4
|
3
|
|
|
3
|
|
26
|
use parent qw(Exporter); |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
14
|
|
5
|
|
|
|
|
|
|
|
6
|
3
|
|
|
3
|
|
3277
|
use Term::ANSIColor (); |
|
3
|
|
|
|
|
25669
|
|
|
3
|
|
|
|
|
599
|
|
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
|
34
|
|
|
34
|
0
|
18414
|
my ($type, $message) = @_; |
20
|
34
|
|
33
|
|
|
157
|
my $color ||= $COLOR{$type}; |
21
|
|
|
|
|
|
|
|
22
|
34
|
50
|
|
|
|
146
|
$message = Term::ANSIColor::colored $message, $color if $color; |
23
|
34
|
|
|
|
|
1053
|
$message .= "\n"; |
24
|
|
|
|
|
|
|
|
25
|
34
|
100
|
|
|
|
121
|
my $fh = $type eq 'error' ? *STDERR : *STDOUT; |
26
|
|
|
|
|
|
|
|
27
|
34
|
|
|
|
|
966
|
print $fh $message; |
28
|
|
|
|
|
|
|
|
29
|
34
|
|
|
|
|
121
|
return; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
!!1; |