Xataface
2.0alpha2
Xataface Application Framework
Main Page
Related Pages
Modules
Namespaces
Data Structures
Files
Examples
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Groups
Pages
Dataface
Logger.php
Go to the documentation of this file.
1
<?php
6
class
Dataface_Logger
{
7
private
$items = array();
8
private
$format=
'html'
;
9
10
public
function
setFormat
($format){
11
$this->format = $format;
12
}
13
public
function
log
($str, $level=0){
14
$this->
items
[] = array(
'message'
=>$str,
'level'
=>$level);
15
}
16
public
function
clear
(){
17
$this->
items
= array();
18
}
19
20
public
function
items
($level=0){
21
$out
= array();
22
foreach
($this->
items
as $i){
23
if
( $i[
'level'
] >= $level )
$out
[] = $i;
24
}
25
return
$out
;
26
}
27
28
public
function
dump
($level=0, $separator =
"\n"
){
29
$messages = array();
30
foreach
($this->
items
($level) as $i){
31
$messages[] = $i[
'message'
];
32
}
33
if
( $this->format ==
'html'
){
34
$messages = array_map(
'htmlspecialchars'
, $messages);
35
}
36
37
echo implode($separator, $messages);
38
}
39
40
}
Generated on Fri Mar 22 2013 09:40:34 for Xataface by
1.8.1.2