From 0f7ba713001879bb7cfd0ca3a84c7683ef4ce212 Mon Sep 17 00:00:00 2001 From: wei <> Date: Thu, 5 Jan 2006 01:23:24 +0000 Subject: adding ILog interface and TInternalLogger --- framework/Log/ILog.php | 74 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 framework/Log/ILog.php (limited to 'framework/Log') diff --git a/framework/Log/ILog.php b/framework/Log/ILog.php new file mode 100644 index 00000000..712f8396 --- /dev/null +++ b/framework/Log/ILog.php @@ -0,0 +1,74 @@ + + * @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); + } +} + +?> \ No newline at end of file -- cgit v1.2.3