Beispiel #1
0
 public function __construct($Conf)
 {
     $this->Conf = $Conf;
     $logConf = $Conf->get('log');
     $this->Log = XLog::factory($logConf['type'], $logConf['name'], $logConf['option']);
     $this->Log->info('XSystem Waik');
 }
Beispiel #2
0
 function __construct($name, $conf, $level)
 {
     parent::__construct();
     $this->_append = isset($conf['append']) && $conf['append'] == 1 ? true : false;
     $this->_dirname = XUtil::arrayGetOr($conf, 'dirname', $this->_dirname);
     $this->_filename = XUtil::arrayGetOr($conf, 'filename', $this->_filename);
     $this->_name = $name;
     $this->_eol = strstr(PHP_OS, 'WIN') ? "\r\n" : "\n";
     $this->_mask = $this->MAX($level);
     // if script is down close fp
     register_shutdown_function(array($this, 'close'));
 }
Beispiel #3
0
 function testObserver()
 {
     $handler = XLog::factory('file', 'default', array('append' => 0, 'dirname' => $this->dirname, 'filename' => 'test1.log'), XLOG_WARNING);
     $var = array();
     $observer = XLog::factoryObserver('var', array('var' => &$var), XLOG_ERR);
     $handler->attach($observer);
     $handler->open();
     $handler->info("TEST");
     $handler->notice("TEST");
     $handler->debug("TEST");
     $handler->warning("TEST");
     $handler->err("TEST");
     $handler->crit("TEST");
     $handler->close();
     $this->assertEquala(2, count($var), 'Observer Failed');
 }
Beispiel #4
0
 /**
  * if is musk
  */
 public function _isMasked($level)
 {
     return XLog::MASK($level) & $this->_mask;
 }