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'); }
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')); }
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'); }
/** * if is musk */ public function _isMasked($level) { return XLog::MASK($level) & $this->_mask; }