line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Log::Fu::Common; |
2
|
5
|
|
|
5
|
|
26
|
use strict; |
|
5
|
|
|
|
|
11
|
|
|
5
|
|
|
|
|
156
|
|
3
|
5
|
|
|
5
|
|
24
|
use warnings; |
|
5
|
|
|
|
|
8
|
|
|
5
|
|
|
|
|
138
|
|
4
|
5
|
|
|
5
|
|
25
|
use base qw(Exporter); |
|
5
|
|
|
|
|
8
|
|
|
5
|
|
|
|
|
686
|
|
5
|
|
|
|
|
|
|
#Simple common levels |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our (@EXPORT,%EXPORT_TAGS,@EXPORT_OK); |
8
|
5
|
|
|
|
|
62
|
use Constant::Generate [qw( |
9
|
|
|
|
|
|
|
LOG_DEBUG |
10
|
|
|
|
|
|
|
LOG_INFO |
11
|
|
|
|
|
|
|
LOG_WARN |
12
|
|
|
|
|
|
|
LOG_ERR |
13
|
|
|
|
|
|
|
LOG_CRIT |
14
|
|
|
|
|
|
|
)], -export_ok => 1, |
15
|
|
|
|
|
|
|
-tag => 'levels', |
16
|
|
|
|
|
|
|
-mapname => 'strlevel', |
17
|
5
|
|
|
5
|
|
4351
|
-export_tags => 1; |
|
5
|
|
|
|
|
108211
|
|
18
|
|
|
|
|
|
|
|
19
|
41
|
|
|
41
|
0
|
203
|
sub LEVELS() { qw(debug info warn err crit) } |
20
|
|
|
|
|
|
|
my @_syslog_levels = qw(DEBUG INFO WARNING ERR CRIT); |
21
|
2
|
|
|
2
|
0
|
11
|
sub syslog_level { $_syslog_levels[$_[0]] } |
22
|
|
|
|
|
|
|
push @EXPORT, qw(syslog_level LEVELS); |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
our %Config; |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
push @EXPORT_OK, '%Config'; |
27
|
|
|
|
|
|
|
my @ansi_terms = qw( |
28
|
|
|
|
|
|
|
xterm |
29
|
|
|
|
|
|
|
xterm-color |
30
|
|
|
|
|
|
|
rxvt |
31
|
|
|
|
|
|
|
urxvt |
32
|
|
|
|
|
|
|
mlterm |
33
|
|
|
|
|
|
|
gnome-terminal |
34
|
|
|
|
|
|
|
konsole |
35
|
|
|
|
|
|
|
screen |
36
|
|
|
|
|
|
|
tmux |
37
|
|
|
|
|
|
|
v100 |
38
|
|
|
|
|
|
|
linux |
39
|
|
|
|
|
|
|
ansi |
40
|
|
|
|
|
|
|
cygwin |
41
|
|
|
|
|
|
|
); |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
sub fu_term_is_ansi { |
44
|
5
|
50
|
|
5
|
0
|
39
|
if(defined $ENV{TERM}) { |
45
|
5
|
|
|
|
|
16
|
foreach my $term (@ansi_terms) { |
46
|
5
|
50
|
|
|
|
55
|
return 1 if (index($ENV{TERM}, $term) >= 0) |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
} |
49
|
0
|
|
|
|
|
|
return 0; |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
push @EXPORT, 'fu_term_is_ansi'; |
53
|
|
|
|
|
|
|
|