Exemplo n.º 1
0
 private function testFile()
 {
     $logFile = LogBase::getFile()->setType(LogBase::TYPE_DAEMON)->setIdentify('Up201405')->add('Find some thing wrong.');
     //支持批量插入 需要同一个日志实例
     $logFile->add('Find 1 thing wrong.');
     $logFile->add('Find 2 thing wrong.');
     $logFile->add('sorry, db falied', TRUE);
     $logFile->add('sorry, db falied');
     $logFile->add('sorry, db falied');
 }
Exemplo n.º 2
0
 /**
  * 获取日志对象
  */
 protected function getLog()
 {
     if ($this->logInstance !== NULL) {
         return $this->logInstance;
     }
     if (!static::LOG_SERVICE || preg_match('/[^\\w]/is', static::LOG_SERVICE)) {
         throw new \Exception("static::LOG_SERVICE 无效。");
     }
     $this->logInstance = LogBase::getFile()->setIdentify(static::LOG_SERVICE)->setType(LogBase::TYPE_DAEMON);
     return $this->logInstance;
 }
Exemplo n.º 3
0
 /**
  * 获取日志对象
  */
 protected function getLog()
 {
     if ($this->logInstance !== NULL) {
         return $this->logInstance;
     }
     $this->logInstance = LogBase::getFile()->setIdentify($this->service)->setType(LogBase::TYPE_DAEMON);
     return $this->logInstance;
 }
Exemplo n.º 4
0
 * 
 * @since 2013/11/10
 * 
 * Log支持储存后端:File, Mysql, Mongo
 * 
 * 适配器接口:
 * 		add($info):添加一条日志信息
 */
use HuiLib\Log\LogBase;
//快速获取一个Apc Log实例
$cache = LogBase::getMysql();
//快速获取一个File Log缓存实例
$cache = LogBase::getFile();
//快速获取一个Memcache Log缓存实例
$cache = LogBase::getMongo();
//File完整示例 支持批量保存多条,但必须在同个log实例
$log = LogBase::getFile();
$log->setType(LogBase::TYPE_USERERROR);
$log->setIdentify('PHPFrameTest');
//会放置到文件名中作为区分
$log->add('sorry, db falied');
$log->add('sorry, db falied');
$log->add('sorry, db falied');
//Mysql完整示例 支持批量保存多条,但必须在同个log实例
//2014-05-25.Up201405.Runtime.log
$log = LogBase::getMysql();
$log->setType(LogBase::TYPE_USERERROR);
$log->setIdentify('PHPFrameTest');
$log->add('sorry, db falied');
$log->add('sorry, db falied');
$log->add('sorry, db falied');