← Index
NYTProf Performance Profile   « block view • line view • sub view »
For mentat.storage.mongo.pl
  Run on Tue Jun 24 09:58:41 2014
Reported on Tue Jun 24 09:59:14 2014

Filename/usr/local/lib/site_perl/Log/Channel/Module.pm
StatementsExecuted 13 statements in 354µs
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
11111µs14µsLog::Channel::Module::::BEGIN@2Log::Channel::Module::BEGIN@2
1117µs50µsLog::Channel::Module::::BEGIN@70Log::Channel::Module::BEGIN@70
1116µs11µsLog::Channel::Module::::BEGIN@3Log::Channel::Module::BEGIN@3
1116µs6µsLog::Channel::Module::::BEGIN@75Log::Channel::Module::BEGIN@75
1116µs24µsLog::Channel::Module::::BEGIN@79Log::Channel::Module::BEGIN@79
1113µs3µsLog::Channel::Module::::BEGIN@78Log::Channel::Module::BEGIN@78
1112µs2µsLog::Channel::Module::::ENDLog::Channel::Module::END
0000s0sLog::Channel::Module::::_initLog::Channel::Module::_init
0000s0sLog::Channel::Module::::_pass_filtersLog::Channel::Module::_pass_filters
0000s0sLog::Channel::Module::::newLog::Channel::Module::new
0000s0sLog::Channel::Module::::writeLog::Channel::Module::write
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1package Log::Channel::Module;
2221µs217µ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
use strict;
# spent 14µs making 1 call to Log::Channel::Module::BEGIN@2 # spent 3µs making 1 call to strict::import
3255µs215µ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
use warnings;
# 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
13Log::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
25Classes extending this base class may be used as CHANNELS in loging framework.
26Channels are used for message processing. Loging framework dispatches each
27message to all registered channels, which can then perform filtering, thresholding
28and write message to different destinations. See default channel implementation in
29class Log::Channel::Channel for details.
30
31=head1 USAGE
32
33=head1 BUGS
34
35=head1 SUPPORT
36
37=head1 AUTHOR
38
39Jan Mach
40Cesnet, z.s.p.o
41jan.mach@cesnet.cz
42http://www.cesnet.cz
43
44=head1 COPYRIGHT
45
46This program is free software; you can redistribute
47it and/or modify it under the same terms as Perl itself.
48
49The full text of the license can be found in the
50LICENSE file included with this module.
51
52
53=head1 SEE ALSO
54
55perl(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 ---------------------------------------------------------#
70230µs292µ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
use Carp;
# 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 ------------------------------------------------#
75228µs16µ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
use Log::Filter::Module;
# 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
BEGIN {
79223µs241µ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
use vars qw($VERSION);
# spent 24µs making 1 call to Log::Channel::Module::BEGIN@79 # spent 18µs making 1 call to vars::import
8013µs $VERSION = '0.01';
811189µs13µs}
# spent 3µs making 1 call to Log::Channel::Module::BEGIN@78
82
83#-- Module clean-up code (global destructor) ----------------------------------#
8412µ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
END {
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
118sub 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
141sub 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
160sub _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
177sub _init {
178 my $self = shift;
179 croak ((caller(0))[3] . ": method needs implementation");
180}
181
182=pod
183
184=back
185
186=cut
187
18812µs1;