Axiom (v1.2.0)

A lightweight PHP framework
H:/Workspace/php-axiom/www/php-axiom/libraries/axiom/axLogger.class.php
Go to the documentation of this file.
00001 <?php
00021 abstract class axLogger {
00022     
00027     const ERR = 1;
00028     const NOTICE = 2;
00029     const WARNING = 4;
00030     const DEBUG = 8;
00031     
00036     protected $_mask;
00037     
00042     protected $_next;
00043     
00048     public function __construct ($mask = false) {
00049         if (!$mask)
00050             $mask = 15;
00051         $this->_mask = $mask;
00052     }
00053     
00059     public function setNext (axLogger $logger) {
00060         return $this->_next = $logger;
00061     }
00062     
00074     public function message ($msg, $priority = self::NOTICE) {
00075         switch ($priority) {
00076             default:
00077             case self::ERR:     $severity = "Error";   break;
00078             case self::NOTICE:  $severity = "Notice";  break;
00079             case self::WARNING: $severity = "Warning"; break;
00080             case self::DEBUG:   $severity = "Debug";   break;
00081         }
00082         
00083         if ($priority & $this->_mask)
00084             $this->writeMessage($msg, $severity);
00085             
00086         if (isset($this->_next))
00087             $this->_next->message($msg, $priority);
00088             
00089         return $this;
00090     }
00091     
00099     abstract public function writeMessage ($msg, $severity);
00100 }
 All Data Structures Files Functions Variables