Filename | /usr/local/lib/site_perl/Log/Channel/Module.pm |
Statements | Executed 13 statements in 354µs |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
1 | 1 | 1 | 11µs | 14µs | BEGIN@2 | Log::Channel::Module::
1 | 1 | 1 | 7µs | 50µs | BEGIN@70 | Log::Channel::Module::
1 | 1 | 1 | 6µs | 11µs | BEGIN@3 | Log::Channel::Module::
1 | 1 | 1 | 6µs | 6µs | BEGIN@75 | Log::Channel::Module::
1 | 1 | 1 | 6µs | 24µs | BEGIN@79 | Log::Channel::Module::
1 | 1 | 1 | 3µs | 3µs | BEGIN@78 | Log::Channel::Module::
1 | 1 | 1 | 2µs | 2µs | END | Log::Channel::Module::
0 | 0 | 0 | 0s | 0s | _init | Log::Channel::Module::
0 | 0 | 0 | 0s | 0s | _pass_filters | Log::Channel::Module::
0 | 0 | 0 | 0s | 0s | new | Log::Channel::Module::
0 | 0 | 0 | 0s | 0s | write | Log::Channel::Module::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | package Log::Channel::Module; | ||||
2 | 2 | 21µs | 2 | 17µs | # spent 14µs (11+3) within Log::Channel::Module::BEGIN@2 which was called:
# once (11µs+3µs) by Log::Channel::Channel::BEGIN@74 at line 2 # spent 14µs making 1 call to Log::Channel::Module::BEGIN@2
# spent 3µs making 1 call to strict::import |
3 | 2 | 55µs | 2 | 15µs | # spent 11µs (6+5) within Log::Channel::Module::BEGIN@3 which was called:
# once (6µs+5µs) by Log::Channel::Channel::BEGIN@74 at line 3 # spent 11µs making 1 call to Log::Channel::Module::BEGIN@3
# spent 5µs making 1 call to warnings::import |
4 | |||||
5 | ################################################################################ | ||||
6 | # | ||||
7 | # DOCUMENTATION SECTION | ||||
8 | # | ||||
9 | ################################################################################ | ||||
10 | |||||
11 | =head1 NAME | ||||
12 | |||||
13 | Log::Channel::Module - Base module defining mandatory interface for all log channel modules | ||||
14 | |||||
15 | =head1 SYNOPSIS | ||||
16 | |||||
17 | use Log::Channel::Module; | ||||
18 | |||||
19 | BEGIN { | ||||
20 | @ISA = ('Log::Channel::Module'); | ||||
21 | } | ||||
22 | |||||
23 | =head1 DESCRIPTION | ||||
24 | |||||
25 | Classes extending this base class may be used as CHANNELS in loging framework. | ||||
26 | Channels are used for message processing. Loging framework dispatches each | ||||
27 | message to all registered channels, which can then perform filtering, thresholding | ||||
28 | and write message to different destinations. See default channel implementation in | ||||
29 | class Log::Channel::Channel for details. | ||||
30 | |||||
31 | =head1 USAGE | ||||
32 | |||||
33 | =head1 BUGS | ||||
34 | |||||
35 | =head1 SUPPORT | ||||
36 | |||||
37 | =head1 AUTHOR | ||||
38 | |||||
39 | Jan Mach | ||||
40 | Cesnet, z.s.p.o | ||||
41 | jan.mach@cesnet.cz | ||||
42 | http://www.cesnet.cz | ||||
43 | |||||
44 | =head1 COPYRIGHT | ||||
45 | |||||
46 | This program is free software; you can redistribute | ||||
47 | it and/or modify it under the same terms as Perl itself. | ||||
48 | |||||
49 | The full text of the license can be found in the | ||||
50 | LICENSE file included with this module. | ||||
51 | |||||
52 | |||||
53 | =head1 SEE ALSO | ||||
54 | |||||
55 | perl(1). | ||||
56 | |||||
57 | =head1 FUNCTION REFERENCE | ||||
58 | |||||
59 | =over 4 | ||||
60 | |||||
61 | =cut | ||||
62 | |||||
63 | ################################################################################ | ||||
64 | # | ||||
65 | # INITIALIZATION AND CLEANUP SECTION | ||||
66 | # | ||||
67 | ################################################################################ | ||||
68 | |||||
69 | #-- Perl core modules ---------------------------------------------------------# | ||||
70 | 2 | 30µs | 2 | 92µs | # spent 50µs (7+43) within Log::Channel::Module::BEGIN@70 which was called:
# once (7µs+43µs) by Log::Channel::Channel::BEGIN@74 at line 70 # spent 50µs making 1 call to Log::Channel::Module::BEGIN@70
# spent 43µs making 1 call to Exporter::import |
71 | |||||
72 | #-- Perl CPAN modules ---------------------------------------------------------# | ||||
73 | |||||
74 | #-- Custom application modules ------------------------------------------------# | ||||
75 | 2 | 28µs | 1 | 6µs | # spent 6µs within Log::Channel::Module::BEGIN@75 which was called:
# once (6µs+0s) by Log::Channel::Channel::BEGIN@74 at line 75 # spent 6µs making 1 call to Log::Channel::Module::BEGIN@75 |
76 | |||||
77 | #-- Module initializations ----------------------------------------------------# | ||||
78 | # spent 3µs within Log::Channel::Module::BEGIN@78 which was called:
# once (3µs+0s) by Log::Channel::Channel::BEGIN@74 at line 81 | ||||
79 | 2 | 23µs | 2 | 41µs | # spent 24µs (6+18) within Log::Channel::Module::BEGIN@79 which was called:
# once (6µs+18µs) by Log::Channel::Channel::BEGIN@74 at line 79 # spent 24µs making 1 call to Log::Channel::Module::BEGIN@79
# spent 18µs making 1 call to vars::import |
80 | 1 | 3µs | $VERSION = '0.01'; | ||
81 | 1 | 189µs | 1 | 3µs | } # spent 3µs making 1 call to Log::Channel::Module::BEGIN@78 |
82 | |||||
83 | #-- Module clean-up code (global destructor) ----------------------------------# | ||||
84 | 1 | 2µs | # spent 2µs within Log::Channel::Module::END which was called:
# once (2µs+0s) by main::RUNTIME at line 0 of mentat.storage.mongo.pl | ||
85 | |||||
86 | } | ||||
87 | |||||
88 | ################################################################################ | ||||
89 | # | ||||
90 | # CONSTANTS AND GLOBAL VARIABLES DEFINITION SECTION | ||||
91 | # | ||||
92 | ################################################################################ | ||||
93 | |||||
94 | #-- Constants -----------------------------------------------------------------# | ||||
95 | |||||
96 | #-- Static public class variables (our) ---------------------------------------# | ||||
97 | |||||
98 | #-- Static protected class variables (my) -------------------------------------# | ||||
99 | |||||
100 | ################################################################################ | ||||
101 | # | ||||
102 | # IMPLEMENTATION SECTION | ||||
103 | # | ||||
104 | ################################################################################ | ||||
105 | |||||
106 | =item new() [PUBLIC,STATIC] | ||||
107 | |||||
108 | Usage : my $channel = Log::Channel::(module)->new($channel_filters, $channel_writers, $dfr); | ||||
109 | Purpose : Create new instance of log channel | ||||
110 | Returns : Reference to the new instance | ||||
111 | Arguments : All arguments are passed to the _init() function | ||||
112 | Throws : Croaks if invoked on object | ||||
113 | Comments : This method should not be overloaded, descendants should implement their version of _init() method instead | ||||
114 | See Also : _init() method | ||||
115 | |||||
116 | =cut | ||||
117 | |||||
118 | sub new | ||||
119 | { | ||||
120 | my $class = shift; | ||||
121 | croak ((caller(0))[3] . ": class method invoked on object") if ref $class; | ||||
122 | my $self = bless ({}, $class); | ||||
123 | return $self->_init(@_); | ||||
124 | } | ||||
125 | |||||
126 | |||||
127 | =item write($$$) [ABSTRACT, PUBLIC] | ||||
128 | |||||
129 | Usage : $channel->write($source, $severity, $message); | ||||
130 | Purpose : Handle given message | ||||
131 | Returns : Must return 1, if the message passed filters, and 0, if it was rejected | ||||
132 | Arguments : string $source - Name of the source of the message | ||||
133 | enum $severity - Severity in integer or string format (see Log::Core::Essentials for permited values) | ||||
134 | string $message - Message | ||||
135 | Throws : Croaks, if not implemented in descendant classes | ||||
136 | Comments : ABSTRACT method, must be implemented in descendant classes | ||||
137 | See Also : Log::Core::Essentials module for permited severity values | ||||
138 | |||||
139 | =cut | ||||
140 | |||||
141 | sub write($$$) { | ||||
142 | my $self = shift; | ||||
143 | croak ((caller(0))[3] . ": method needs implementation"); | ||||
144 | } | ||||
145 | |||||
146 | =item pass_filters() [ABSTRACT, PUBLIC] | ||||
147 | |||||
148 | Usage : $channel->pass_filters($source, $severity, $message) | ||||
149 | Purpose : Test, if the given message passess all filters in this channel | ||||
150 | Returns : Log::Filter::Module::ACCEPT on success, Log::Filter::Module::REJECT on failure | ||||
151 | Arguments : string $source - Name of the source of the message | ||||
152 | enum $severity - Severity in integer or string format (see Log::Core::Essentials for permited values) | ||||
153 | string $message - Message | ||||
154 | Throws : Croaks, if not implemented in descendant classes | ||||
155 | Comments : ABSTRACT method, must be implemented in descendant classes | ||||
156 | See Also : Log::Core::Essentials module for permited severity values | ||||
157 | |||||
158 | =cut | ||||
159 | |||||
160 | sub _pass_filters($$$) { | ||||
161 | my $self = shift; | ||||
162 | croak ((caller(0))[3] . ": method needs implementation"); | ||||
163 | } | ||||
164 | |||||
165 | =item _init() [ABSTRACT, PROTECTED] | ||||
166 | |||||
167 | Usage : Used from constructor as follows: return $self->_init(@_); | ||||
168 | Purpose : Initialize newly created channel instance | ||||
169 | Returns : Must return $self | ||||
170 | Arguments : Unknown, depend on the implementation | ||||
171 | Throws : Croaks, if not implemented in descendant classes | ||||
172 | Comments : ABSTRACT method, must be implemented in descendant classes | ||||
173 | See Also : new() method | ||||
174 | |||||
175 | =cut | ||||
176 | |||||
177 | sub _init { | ||||
178 | my $self = shift; | ||||
179 | croak ((caller(0))[3] . ": method needs implementation"); | ||||
180 | } | ||||
181 | |||||
182 | =pod | ||||
183 | |||||
184 | =back | ||||
185 | |||||
186 | =cut | ||||
187 | |||||
188 | 1 | 2µs | 1; |