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
|
|
580
|
use strict;
|
|
6
|
|
|
|
|
14
|
|
|
6
|
|
|
|
|
287
|
|
15
|
|
|
|
|
|
|
require Log::Agent::Driver;
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
########################################################################
|
18
|
|
|
|
|
|
|
package Log::Agent::Driver::Default;
|
19
|
|
|
|
|
|
|
|
20
|
6
|
|
|
6
|
|
32
|
use vars qw(@ISA);
|
|
6
|
|
|
|
|
12
|
|
|
6
|
|
|
|
|
3915
|
|
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
@ISA = qw(Log::Agent::Driver);
|
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
#
|
25
|
|
|
|
|
|
|
# ->make -- defined
|
26
|
|
|
|
|
|
|
#
|
27
|
|
|
|
|
|
|
# Creation routine.
|
28
|
|
|
|
|
|
|
#
|
29
|
|
|
|
|
|
|
sub make {
|
30
|
6
|
|
|
6
|
1
|
30
|
my $self = bless {}, shift;
|
31
|
6
|
|
|
|
|
15
|
my ($prefix) = @_;
|
32
|
6
|
|
|
|
|
44
|
$self->_init($prefix, 0); # 0 is the skip Carp penalty
|
33
|
6
|
|
|
|
|
39
|
select((select(main::STDERR), $| = 1)[0]); # Autoflush
|
34
|
6
|
|
|
|
|
137
|
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
|
31
|
|
|
31
|
1
|
51
|
my $self = shift;
|
45
|
31
|
|
|
|
|
55
|
my ($str) = @_;
|
46
|
31
|
|
|
|
|
89
|
my $prefix = $self->prefix;
|
47
|
31
|
100
|
66
|
|
|
563
|
return ucfirst($str) if !defined($prefix) || $prefix eq '';
|
48
|
10
|
|
|
|
|
105
|
return "$prefix: " . $str;
|
49
|
|
|
|
|
|
|
}
|
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
#
|
52
|
|
|
|
|
|
|
# ->write -- defined
|
53
|
|
|
|
|
|
|
#
|
54
|
|
|
|
|
|
|
sub write {
|
55
|
8
|
|
|
8
|
1
|
11
|
my $self = shift;
|
56
|
8
|
|
|
|
|
17
|
my ($channel, $priority, $logstring) = @_;
|
57
|
8
|
|
|
|
|
30
|
local $\ = undef;
|
58
|
8
|
|
|
|
|
270
|
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
|
|
|
|
|
|
|
# ->logxcroak -- redefined
|
86
|
|
|
|
|
|
|
#
|
87
|
|
|
|
|
|
|
# Fatal error, from perspective of caller
|
88
|
|
|
|
|
|
|
#
|
89
|
|
|
|
|
|
|
sub logxcroak {
|
90
|
1
|
|
|
1
|
1
|
3
|
my $self = shift;
|
91
|
1
|
|
|
|
|
2
|
my ($offset, $str) = @_;
|
92
|
1
|
|
|
|
|
6
|
require Carp;
|
93
|
1
|
|
|
|
|
5
|
my $msg = $self->carpmess($offset, $str, \&Carp::shortmess);
|
94
|
1
|
|
|
|
|
5
|
die $self->prefix_msg("$msg\n");
|
95
|
|
|
|
|
|
|
}
|
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
#
|
98
|
|
|
|
|
|
|
# ->logdie -- redefined
|
99
|
|
|
|
|
|
|
#
|
100
|
|
|
|
|
|
|
# Fatal error
|
101
|
|
|
|
|
|
|
#
|
102
|
|
|
|
|
|
|
sub logdie {
|
103
|
8
|
|
|
8
|
1
|
15
|
my $self = shift;
|
104
|
8
|
|
|
|
|
18
|
my ($str) = @_;
|
105
|
8
|
|
|
|
|
31
|
die $self->prefix_msg("$str\n");
|
106
|
|
|
|
|
|
|
}
|
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
#
|
109
|
|
|
|
|
|
|
# ->logerr -- redefined
|
110
|
|
|
|
|
|
|
#
|
111
|
|
|
|
|
|
|
# Signal error on stderr
|
112
|
|
|
|
|
|
|
#
|
113
|
|
|
|
|
|
|
sub logerr {
|
114
|
2
|
|
|
2
|
1
|
5
|
my $self = shift;
|
115
|
2
|
|
|
|
|
2
|
my ($str) = @_;
|
116
|
2
|
|
|
|
|
10
|
warn $self->prefix_msg("$str\n");
|
117
|
|
|
|
|
|
|
}
|
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
#
|
120
|
|
|
|
|
|
|
# ->logwarn -- redefined
|
121
|
|
|
|
|
|
|
#
|
122
|
|
|
|
|
|
|
# Warn, with "WARNING" clearly emphasized
|
123
|
|
|
|
|
|
|
#
|
124
|
|
|
|
|
|
|
sub logwarn {
|
125
|
1
|
|
|
1
|
1
|
2
|
my $self = shift;
|
126
|
1
|
|
|
|
|
2
|
my ($str) = @_;
|
127
|
1
|
|
|
|
|
4
|
$str->prepend("WARNING: ");
|
128
|
1
|
|
|
|
|
4
|
warn $self->prefix_msg("$str\n");
|
129
|
|
|
|
|
|
|
}
|
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
#
|
132
|
|
|
|
|
|
|
# ->logxcarp -- redefined
|
133
|
|
|
|
|
|
|
#
|
134
|
|
|
|
|
|
|
# Warn from perspective of caller, with "WARNING" clearly emphasized.
|
135
|
|
|
|
|
|
|
#
|
136
|
|
|
|
|
|
|
sub logxcarp {
|
137
|
11
|
|
|
11
|
1
|
18
|
my $self = shift;
|
138
|
11
|
|
|
|
|
19
|
my ($offset, $str) = @_;
|
139
|
11
|
|
|
|
|
32
|
$str->prepend("WARNING: ");
|
140
|
11
|
|
|
|
|
47
|
require Carp;
|
141
|
11
|
|
|
|
|
41
|
my $msg = $self->carpmess($offset, $str, \&Carp::shortmess);
|
142
|
11
|
|
|
|
|
34
|
warn $self->prefix_msg("$msg\n");
|
143
|
|
|
|
|
|
|
}
|
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
1; # for require
|
146
|
|
|
|
|
|
|
__END__
|