| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
########################################################################### |
|
2
|
|
|
|
|
|
|
# |
|
3
|
|
|
|
|
|
|
# Default.pm |
|
4
|
|
|
|
|
|
|
# |
|
5
|
|
|
|
|
|
|
# Copyright (C) 1999 Raphael Manfredi. |
|
6
|
|
|
|
|
|
|
# Copyright (C) 2002-2017 Mark Rogaski, mrogaski@cpan.org; |
|
7
|
|
|
|
|
|
|
# all rights reserved. |
|
8
|
|
|
|
|
|
|
# |
|
9
|
|
|
|
|
|
|
# See the README file included with the |
|
10
|
|
|
|
|
|
|
# distribution for license information. |
|
11
|
|
|
|
|
|
|
# |
|
12
|
|
|
|
|
|
|
########################################################################## |
|
13
|
|
|
|
|
|
|
|
|
14
|
6
|
|
|
6
|
|
509
|
use strict; |
|
|
6
|
|
|
|
|
13
|
|
|
|
6
|
|
|
|
|
310
|
|
|
15
|
|
|
|
|
|
|
require Log::Agent::Driver; |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
######################################################################## |
|
18
|
|
|
|
|
|
|
package Log::Agent::Driver::Default; |
|
19
|
|
|
|
|
|
|
|
|
20
|
6
|
|
|
6
|
|
34
|
use vars qw(@ISA); |
|
|
6
|
|
|
|
|
14
|
|
|
|
6
|
|
|
|
|
4225
|
|
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
@ISA = qw(Log::Agent::Driver); |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
# |
|
25
|
|
|
|
|
|
|
# ->make -- defined |
|
26
|
|
|
|
|
|
|
# |
|
27
|
|
|
|
|
|
|
# Creation routine. |
|
28
|
|
|
|
|
|
|
# |
|
29
|
|
|
|
|
|
|
sub make { |
|
30
|
6
|
|
|
6
|
1
|
31
|
my $self = bless {}, shift; |
|
31
|
6
|
|
|
|
|
17
|
my ($prefix) = @_; |
|
32
|
6
|
|
|
|
|
44
|
$self->_init($prefix, 0); # 0 is the skip Carp penalty |
|
33
|
6
|
|
|
|
|
46
|
select((select(main::STDERR), $| = 1)[0]); # Autoflush |
|
34
|
6
|
|
|
|
|
122
|
return $self; |
|
35
|
|
|
|
|
|
|
} |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
# |
|
38
|
|
|
|
|
|
|
# ->prefix_msg -- defined |
|
39
|
|
|
|
|
|
|
# |
|
40
|
|
|
|
|
|
|
# Prepend "prefix: " to the error string, or nothing if no prefix, in which |
|
41
|
|
|
|
|
|
|
# case we capitalize the very first letter of the string. |
|
42
|
|
|
|
|
|
|
# |
|
43
|
|
|
|
|
|
|
sub prefix_msg { |
|
44
|
33
|
|
|
33
|
1
|
56
|
my $self = shift; |
|
45
|
33
|
|
|
|
|
56
|
my ($str) = @_; |
|
46
|
33
|
|
|
|
|
94
|
my $prefix = $self->prefix; |
|
47
|
33
|
100
|
66
|
|
|
593
|
return ucfirst($str) if !defined($prefix) || $prefix eq ''; |
|
48
|
12
|
|
|
|
|
113
|
return "$prefix: " . $str; |
|
49
|
|
|
|
|
|
|
} |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
# |
|
52
|
|
|
|
|
|
|
# ->write -- defined |
|
53
|
|
|
|
|
|
|
# |
|
54
|
|
|
|
|
|
|
sub write { |
|
55
|
11
|
|
|
11
|
1
|
17
|
my $self = shift; |
|
56
|
11
|
|
|
|
|
22
|
my ($channel, $priority, $logstring) = @_; |
|
57
|
11
|
|
|
|
|
38
|
local $\ = undef; |
|
58
|
11
|
|
|
|
|
311
|
print main::STDERR "$logstring\n"; |
|
59
|
|
|
|
|
|
|
} |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
# |
|
62
|
|
|
|
|
|
|
# ->channel_eq -- defined |
|
63
|
|
|
|
|
|
|
# |
|
64
|
|
|
|
|
|
|
# All channels equals here |
|
65
|
|
|
|
|
|
|
# |
|
66
|
|
|
|
|
|
|
sub channel_eq { |
|
67
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
|
68
|
0
|
|
|
|
|
0
|
return 1; |
|
69
|
|
|
|
|
|
|
} |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
# |
|
72
|
|
|
|
|
|
|
# ->logconfess -- redefined |
|
73
|
|
|
|
|
|
|
# |
|
74
|
|
|
|
|
|
|
# Fatal error, with stack trace |
|
75
|
|
|
|
|
|
|
# |
|
76
|
|
|
|
|
|
|
sub logconfess { |
|
77
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
|
78
|
0
|
|
|
|
|
0
|
my ($str) = @_; |
|
79
|
0
|
|
|
|
|
0
|
require Carp; |
|
80
|
0
|
|
|
|
|
0
|
my $msg = $self->carpmess(0, $str, \&Carp::longmess); |
|
81
|
0
|
|
|
|
|
0
|
die $self->prefix_msg("$msg\n"); |
|
82
|
|
|
|
|
|
|
} |
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
# |
|
85
|
|
|
|
|
|
|
# ->logcluck -- redefined |
|
86
|
|
|
|
|
|
|
# |
|
87
|
|
|
|
|
|
|
# Warning, with stack trace |
|
88
|
|
|
|
|
|
|
# |
|
89
|
|
|
|
|
|
|
sub logcluck { |
|
90
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
|
91
|
0
|
|
|
|
|
0
|
my ($str) = @_; |
|
92
|
0
|
|
|
|
|
0
|
require Carp; |
|
93
|
0
|
|
|
|
|
0
|
my $msg = $self->carpmess(0, $str, \&Carp::longmess); |
|
94
|
0
|
|
|
|
|
0
|
warn $self->prefix_msg("$msg\n"); |
|
95
|
|
|
|
|
|
|
} |
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
# |
|
98
|
|
|
|
|
|
|
# ->logxcroak -- redefined |
|
99
|
|
|
|
|
|
|
# |
|
100
|
|
|
|
|
|
|
# Fatal error, from perspective of caller |
|
101
|
|
|
|
|
|
|
# |
|
102
|
|
|
|
|
|
|
sub logxcroak { |
|
103
|
1
|
|
|
1
|
1
|
2
|
my $self = shift; |
|
104
|
1
|
|
|
|
|
2
|
my ($offset, $str) = @_; |
|
105
|
1
|
|
|
|
|
5
|
require Carp; |
|
106
|
1
|
|
|
|
|
8
|
my $msg = $self->carpmess($offset, $str, \&Carp::shortmess); |
|
107
|
1
|
|
|
|
|
4
|
die $self->prefix_msg("$msg\n"); |
|
108
|
|
|
|
|
|
|
} |
|
109
|
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
# |
|
111
|
|
|
|
|
|
|
# ->logdie -- redefined |
|
112
|
|
|
|
|
|
|
# |
|
113
|
|
|
|
|
|
|
# Fatal error |
|
114
|
|
|
|
|
|
|
# |
|
115
|
|
|
|
|
|
|
sub logdie { |
|
116
|
8
|
|
|
8
|
1
|
14
|
my $self = shift; |
|
117
|
8
|
|
|
|
|
16
|
my ($str) = @_; |
|
118
|
8
|
|
|
|
|
37
|
die $self->prefix_msg("$str\n"); |
|
119
|
|
|
|
|
|
|
} |
|
120
|
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
# |
|
122
|
|
|
|
|
|
|
# ->logerr -- redefined |
|
123
|
|
|
|
|
|
|
# |
|
124
|
|
|
|
|
|
|
# Signal error on stderr |
|
125
|
|
|
|
|
|
|
# |
|
126
|
|
|
|
|
|
|
sub logerr { |
|
127
|
2
|
|
|
2
|
1
|
4
|
my $self = shift; |
|
128
|
2
|
|
|
|
|
5
|
my ($str) = @_; |
|
129
|
2
|
|
|
|
|
13
|
warn $self->prefix_msg("$str\n"); |
|
130
|
|
|
|
|
|
|
} |
|
131
|
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
# |
|
133
|
|
|
|
|
|
|
# ->logwarn -- redefined |
|
134
|
|
|
|
|
|
|
# |
|
135
|
|
|
|
|
|
|
# Warn, with "WARNING" clearly emphasized |
|
136
|
|
|
|
|
|
|
# |
|
137
|
|
|
|
|
|
|
sub logwarn { |
|
138
|
1
|
|
|
1
|
1
|
2
|
my $self = shift; |
|
139
|
1
|
|
|
|
|
2
|
my ($str) = @_; |
|
140
|
1
|
|
|
|
|
4
|
$str->prepend("WARNING: "); |
|
141
|
1
|
|
|
|
|
3
|
warn $self->prefix_msg("$str\n"); |
|
142
|
|
|
|
|
|
|
} |
|
143
|
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
# |
|
145
|
|
|
|
|
|
|
# ->logxcarp -- redefined |
|
146
|
|
|
|
|
|
|
# |
|
147
|
|
|
|
|
|
|
# Warn from perspective of caller, with "WARNING" clearly emphasized. |
|
148
|
|
|
|
|
|
|
# |
|
149
|
|
|
|
|
|
|
sub logxcarp { |
|
150
|
11
|
|
|
11
|
1
|
19
|
my $self = shift; |
|
151
|
11
|
|
|
|
|
19
|
my ($offset, $str) = @_; |
|
152
|
11
|
|
|
|
|
35
|
$str->prepend("WARNING: "); |
|
153
|
11
|
|
|
|
|
49
|
require Carp; |
|
154
|
11
|
|
|
|
|
38
|
my $msg = $self->carpmess($offset, $str, \&Carp::shortmess); |
|
155
|
11
|
|
|
|
|
37
|
warn $self->prefix_msg("$msg\n"); |
|
156
|
|
|
|
|
|
|
} |
|
157
|
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
1; # for require |
|
159
|
|
|
|
|
|
|
__END__ |