| [ Index ] |
PHP Cross Reference of Limb3 |
[Summary view] [Print] [Text view]
1 <?php 2 /* 3 * Limb PHP Framework 4 * 5 * @link http://limb-project.com 6 * @copyright Copyright © 2004-2007 BIT(http://bit-creative.com) 7 * @license LGPL http://www.gnu.org/copyleft/lesser.html 8 */ 9 10 lmb_require('limb/core/src/lmbSys.class.php'); 11 12 /** 13 * class lmbLogEntry. 14 * 15 * @package log 16 * @version $Id$ 17 */ 18 class lmbLogEntry 19 { 20 protected $level; 21 protected $time; 22 protected $message; 23 protected $params; 24 protected $backtrace; 25 26 function __construct($level, $message, $params = array(), $backtrace = null, $time = null) 27 { 28 $this->level = $level; 29 $this->message = $message; 30 $this->params = $params; 31 $this->backtrace = $backtrace; 32 $this->time = !$time ? time() : $time; 33 } 34 35 function getLevel() 36 { 37 return $this->level; 38 } 39 40 function getMessage() 41 { 42 return $this->message; 43 } 44 45 function getTime() 46 { 47 return $this->time; 48 } 49 50 function isLevel($level) 51 { 52 return $this->level == $level; 53 } 54 55 function getLevelForHuman() 56 { 57 $level = ''; 58 59 switch($this->level) 60 { 61 case lmbLog :: NOTICE: 62 $level = 'notice'; 63 break; 64 65 case lmbLog :: WARNING: 66 $level = 'warning'; 67 break; 68 69 case lmbLog :: ERROR: 70 $level = 'error'; 71 break; 72 73 case lmbLog :: INFO: 74 $level = 'info'; 75 break; 76 } 77 return $level; 78 } 79 80 function toString() 81 { 82 return lmbSys :: isCli() ? $this->asText() : $this->asHtml(); 83 } 84 85 function asText() 86 { 87 $string = "Message: {$this->message}"; 88 $string .= (count($this->params) ? "\nAdditional attributes: " . var_export($this->params, true) : ''); 89 if($this->backtrace) 90 $string .= "\nBack trace:\n" . $this->backtrace->toString(); 91 92 return $string; 93 } 94 95 function asHtml() 96 { 97 return '<pre>' . htmlspecialchars($this->asText()) . '</pre>'; 98 } 99 } 100 101 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Sat Nov 22 03:48:54 2008 | Cross-referenced by PHPXref 0.7 |