line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Log::Log4perl::Layout::Syslog; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
147417
|
use 5.006; |
|
1
|
|
|
|
|
4
|
|
4
|
1
|
|
|
1
|
|
8
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
31
|
|
5
|
1
|
|
|
1
|
|
7
|
use warnings; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
170
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=encoding utf8 |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=head1 NAME |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
Log::Log4perl::Layout::Syslog - Layout in Syslog format |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
=head1 VERSION |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
Version 0.02 |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=cut |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
our $VERSION = '0.02'; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=head1 SYNOPSIS |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
This format is useful with the Log::Dispatch::Syslog class. |
24
|
|
|
|
|
|
|
Add this to your configuration file: |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
log4perl.appender.A1=Log::Dispatch::Syslog |
27
|
|
|
|
|
|
|
log4perl.appender.A1.Filter=RangeAll |
28
|
|
|
|
|
|
|
log4perl.appender.A1.ident=bandsman |
29
|
|
|
|
|
|
|
log4perl.appender.A1.layout=Log::Log4perl::Layout::Syslog |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
Much of the actual formatting is done by the Sys::Syslog code called |
32
|
|
|
|
|
|
|
from Log::Dispatch::Syslog, |
33
|
|
|
|
|
|
|
however you can't use Log::Log4perl::Layout::NoopLayout |
34
|
|
|
|
|
|
|
since that doesn't insert the ident data that's needed by systems such as |
35
|
|
|
|
|
|
|
flutentd. |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=cut |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=head2 new |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
use Log::Log4perl::Layout::Syslog; |
42
|
|
|
|
|
|
|
my $layout = Log::Log4perl::Layout::Syslog->new(); |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=cut |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub new { |
47
|
1
|
|
|
1
|
1
|
158
|
my $class = shift; |
48
|
1
|
|
33
|
|
|
7
|
$class = ref ($class) || $class; |
49
|
|
|
|
|
|
|
|
50
|
1
|
|
|
|
|
6
|
return bless { |
51
|
|
|
|
|
|
|
info_needed => {}, |
52
|
|
|
|
|
|
|
stack => [], |
53
|
|
|
|
|
|
|
}, $class; |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=head2 render |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
Render a message in the correct format. |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=cut |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
sub render { |
63
|
|
|
|
|
|
|
# my($self, $message, $category, $priority, $caller_level) = @_; |
64
|
1
|
|
|
1
|
1
|
574
|
my $message = $_[1]; |
65
|
|
|
|
|
|
|
|
66
|
1
|
|
|
|
|
11
|
return "user: $message"; |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=head1 AUTHOR |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
Nigel Horne, C<< >> |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=head1 BUGS |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
I can't work out how to get the ident given to |
76
|
|
|
|
|
|
|
Log::Dispatch::Syslog's constructor, |
77
|
|
|
|
|
|
|
so ident (facility in RFC3164 lingo) is always sent to |
78
|
|
|
|
|
|
|
LOG_USER. |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=head1 SEE ALSO |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
L |
83
|
|
|
|
|
|
|
L |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=head1 SUPPORT |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
You can find documentation for this module with the perldoc command. |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
perldoc Log-Log4perl-Layout-Syslog |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
You can also look for information at: |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=over 4 |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=item * RT: CPAN's request tracker |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
L |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=item * AnnoCPAN: Annotated CPAN documentation |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
L |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=item * CPAN Ratings |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
L |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=item * Search CPAN |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
L |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
=back |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
Copyright 2017 Nigel Horne. |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
This program is released under the following licence: GPL2 |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
=cut |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
1; |