예제 #1
0
파일: log.php 프로젝트: chenyongze/iwebshop
 public function __construct($logType = '')
 {
     if ($logType === '') {
         $logType = isset(IWeb::$app->config['logs']['type']) ? IWeb::$app->config['logs']['type'] : $this->logType;
     }
     $this->log = ILogFactory::getInstance($logType);
 }
예제 #2
0
 /**
  * @brief   生成日志处理对象,包换各种介质的日志处理对象,单例模式
  * @logType string $logType 日志类型
  * @return  object 日志对象
  */
 public static function getInstance($logType = '')
 {
     $className = isset(self::$logClass[$logType]) ? self::$logClass[$logType] : $logType;
     if (!class_exists($className)) {
         throw new IException("the {$className} class is not exists");
     }
     if (!self::$log instanceof $className) {
         self::$log = new $className();
     }
     return self::$log;
 }