← Index
NYTProf Performance Profile   « line view »
For ./view
  Run on Fri Jul 31 19:05:14 2015
Reported on Fri Jul 31 19:08:09 2015

Filename/var/www/foswiki11/lib/Foswiki/Logger.pm
StatementsExecuted 7 statements in 183µs
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
11115µs32µsFoswiki::Logger::::BEGIN@4Foswiki::Logger::BEGIN@4
11111µs18µsFoswiki::Logger::::BEGIN@5Foswiki::Logger::BEGIN@5
1119µs23µsFoswiki::Logger::::BEGIN@7Foswiki::Logger::BEGIN@7
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
4242µs250µs
# spent 32µs (15+18) within Foswiki::Logger::BEGIN@4 which was called: # once (15µs+18µs) by Foswiki::BEGIN@629 at line 4
use strict;
# spent 32µs making 1 call to Foswiki::Logger::BEGIN@4 # spent 18µs making 1 call to strict::import
5227µs224µs
# spent 18µs (11+6) within Foswiki::Logger::BEGIN@5 which was called: # once (11µs+6µs) by Foswiki::BEGIN@629 at line 5
use warnings;
# spent 18µs making 1 call to Foswiki::Logger::BEGIN@5 # spent 6µs making 1 call to warnings::import
6
72111µs237µs
# spent 23µs (9+14) within Foswiki::Logger::BEGIN@7 which was called: # once (9µs+14µs) by Foswiki::BEGIN@629 at line 7
use Assert;
# spent 23µs making 1 call to Foswiki::Logger::BEGIN@7 # spent 14µ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 log($level, @fields)
30
31Adds a log message to a log.
32
33 * =$level= - level of the event - one of =debug=, =info=,
34 =warning=, =error=, =critical=, =alert=, =emergency=.
35 * =@fields= - an arbitrary list of fields to output to the log.
36 These fields are recoverable when the log is enumerated using the
37 =eachEventSince= method.
38
39The levels are chosen to be compatible with Log::Dispatch.
40
41=cut
42
43# Default behaviour is a NOP
44sub log {
45}
46
47=begin TML
48
49---++ ObjectMethod eachEventSince($time, $level) -> $iterator
50 * =$time= - a time in the past
51 * =$level= - log level to return events for.
52
53Get an iterator over the list of all the events at the given level
54between =$time= and now.
55
56Events are returned in *oldest-first* order.
57
58Each event is returned as a reference to an array. The first element
59of this array is always the date of the event (seconds since the epoch).
60Subsequent elements are the fields passed to =log=.
61
62Note that a log implementation may choose to collapse several log levels
63into a single log. In this case, all messages in the same set as the
64requested level will be returned if any of the collapsed levels is selected.
65
66=cut
67
68# Default behaviour is an empty iteration
69sub eachEventSince {
70 require Foswiki::ListIterator;
71 return new Foswiki::ListIterator( [] );
72}
73
7412µs1;
75__END__