← Index
NYTProf Performance Profile   « block view • line view • sub view »
For /usr/local/src/github.com/foswiki/core/bin/view
  Run on Sun Dec 4 17:17:59 2011
Reported on Sun Dec 4 17:26:40 2011

Filename/usr/local/src/github.com/foswiki/core/lib/Foswiki/Logger.pm
StatementsExecuted 8 statements in 384µs
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
11128µs35µsFoswiki::Logger::::BEGIN@4Foswiki::Logger::BEGIN@4
11119µs63µsFoswiki::Logger::::BEGIN@7Foswiki::Logger::BEGIN@7
11116µs34µsFoswiki::Logger::::BEGIN@5Foswiki::Logger::BEGIN@5
1118µs8µsFoswiki::Logger::::finishFoswiki::Logger::finish
0000s0sFoswiki::Logger::::eachEventSinceFoswiki::Logger::eachEventSince
0000s0sFoswiki::Logger::::logFoswiki::Logger::log
0000s0sFoswiki::Logger::::newFoswiki::Logger::new
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1# See bottom of file for license and copyright information
2package Foswiki::Logger;
3
4244µs243µs
# spent 35µs (28+7) within Foswiki::Logger::BEGIN@4 which was called: # once (28µs+7µs) by Foswiki::BEGIN@606 at line 4
use strict;
# spent 35µs making 1 call to Foswiki::Logger::BEGIN@4 # spent 7µs making 1 call to strict::import
5289µs253µs
# spent 34µs (16+19) within Foswiki::Logger::BEGIN@5 which was called: # once (16µs+19µs) by Foswiki::BEGIN@606 at line 5
use warnings;
# spent 34µs making 1 call to Foswiki::Logger::BEGIN@5 # spent 19µs making 1 call to warnings::import
6
72237µs2107µs
# spent 63µs (19+44) within Foswiki::Logger::BEGIN@7 which was called: # once (19µs+44µs) by Foswiki::BEGIN@606 at line 7
use Assert;
# spent 63µs making 1 call to Foswiki::Logger::BEGIN@7 # spent 44µs making 1 call to Assert::import
8
9=begin TML
10
11---+ package Foswiki::Logger
12
13Object that interfaces to whatever records Foswiki log files.
14
15This is a base class which will be subclassed by a class in the
16Logger subdirectory and selected by $Foswiki::cfg{Log}{Implementation}
17
18Note that the implementation has to provide a way for the log to be replayed.
19Unfortunately this means that the simpler CPAN loggers are not suitable.
20
21=cut
22
23sub new {
24 return bless( {}, shift );
25}
26
27=begin TML
28
29---++ ObjectMethod finish()
30Release memory. Subclasses must implement this if they use any fields
31in the object.
32
33=cut
34
35
# spent 8µs within Foswiki::Logger::finish which was called: # once (8µs+0s) by Foswiki::finish at line 2100 of /usr/local/src/github.com/foswiki/core/lib/Foswiki.pm
sub finish {
36110µs my $this = shift;
37}
38
39=begin TML
40
41---++ ObjectMethod log($level, @fields)
42
43Adds a log message to a log.
44
45 * =$level= - level of the event - one of =debug=, =info=,
46 =warning=, =error=, =critical=, =alert=, =emergency=.
47 * =@fields= - an arbitrary list of fields to output to the log.
48 These fields are recoverable when the log is enumerated using the
49 =eachEventSince= method.
50
51The levels are chosen to be compatible with Log::Dispatch.
52
53=cut
54
55# Default behaviour is a NOP
56sub log {
57}
58
59=begin TML
60
61---++ ObjectMethod eachEventSince($time, $level) -> $iterator
62 * =$time= - a time in the past
63 * =$level= - log level to return events for.
64
65Get an iterator over the list of all the events at the given level
66between =$time= and now.
67
68Events are returned in *oldest-first* order.
69
70Each event is returned as a reference to an array. The first element
71of this array is always the date of the event (seconds since the epoch).
72Subsequent elements are the fields passed to =log=.
73
74Note that a log implementation may choose to collapse several log levels
75into a single log. In this case, all messages in the same set as the
76requested level will be returned if any of the collapsed levels is selected.
77
78=cut
79
80# Default behaviour is an empty iteration
81sub eachEventSince {
82 return new Foswiki::ListIterator( [] );
83}
84
8514µs1;
86__END__