summaryrefslogtreecommitdiff
path: root/framework/Log/TEventLog.php
blob: 8fb566181fcf0b62c5b7a02dffd61e88122575fa (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
75
76
77
78
<?php

Prado::using('System.Log.ILog');
Prado::using('System.Log.TLogManager');

/**
 * ${classname}
 *
 * ${description}
 *
 * @author Wei Zhuo<weizhuo[at]gmail[dot]com>
 * @version $Revision: 1.66 $  $Date: ${DATE} ${TIME} $
 * @package ${package}
 */
class TEventLog extends TLogManager implements ILog
{
	public function init($config)
	{
		parent::init($config);
		$this->collectInternalLog();
	}

	public function __destruct()
	{
		$this->collectInternalLog();
	}

	protected function collectInternalLog()
	{
		foreach(Prado::coreLog()->entries as $entry)
			$this->log($entry[0], $entry[1], $entry[2]);
		Prado::coreLog()->entries = array();
	}

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

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

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

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

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

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

	protected function log($msg, $code, $info)
	{
		ezcLog::getInstance()->log($msg, $code, $info);
	}
}

?>