summaryrefslogtreecommitdiff
path: root/framework/Log/ILog.php
blob: 712f8396d6039d899f039d37bce20b8b454619ca (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
<?php

interface ILog
{
	public function info($msg, $source='Prado', $category='core');
	public function debug($msg, $source='Prado', $category='core');
	public function notice($msg, $source='Prado', $category='core');
	public function warn($msg, $source='Prado', $category='core');
	public function error($msg, $source='Prado', $category='core');
	public function fatal($msg, $source='Prado', $category='core');
}

require_once(dirname(__FILE__).'/EventLog/log.php');

/**
 * ${classname}
 *
 * ${description}
 *
 * @author Wei Zhuo<weizhuo[at]gmail[dot]com>
 * @version $Revision: 1.66 $  $Date: ${DATE} ${TIME} $
 * @package ${package}
 */
class TInternalLogger
{
	public $entries = array();

	public function info($msg, $source='Prado', $category='core')
	{
		$this->log($msg, ezcLog::INFO, 
			array('source'=>$source, 'category'=>$category));
	}
	public function debug($msg, $source='Prado', $category='core')
	{
		$this->log($msg, ezcLog::DEBUG, 
			array('source'=>$source, 'category'=>$category));	
	}
	public function notice($msg, $source='Prado', $category='core')
	{
		$this->log($msg, ezcLog::NOTICE, 
			array('source'=>$source, 'category'=>$category));
	}

	public function warn($msg, $source='Prado', $category='core')
	{
		$this->log($msg, ezcLog::WARNING, 
			array('source'=>$source, 'category'=>$category));
	}

	public function error($msg, $source='Prado', $category='core')
	{
		$this->log($msg, ezcLog::ERROR, 
			array('source'=>$source, 'category'=>$category));	
	}

	public function fatal($msg, $source='Prado', $category='core')
	{
		$this->log($msg, ezcLog::FATAL, 
			array('source'=>$source, 'category'=>$category));
	}

	protected function log($msg, $type, $info)
	{
		if($info['category']=='core')
		{
			$trace = debug_backtrace();
			$info['category'] = $trace[3]['class'];
		}
		$info['time'] = microtime(true);
		$this->entries[] = array($msg, $type, $info);
	}
}

?>