删除不支持的log类型,改进log类型不存在的异常处理 (#181)

* 删除不支持的log类型,改进log类型不存在的异常处理
This commit is contained in:
CantonBolo
2016-06-30 13:21:46 +08:00
committed by 云无心
parent 12081bb1e3
commit bb3633841d
2 changed files with 6 additions and 3 deletions

View File

@@ -75,11 +75,9 @@ return [
'think\Hook' => CORE_PATH . 'Hook' . EXT,
'think\Lang' => CORE_PATH . 'Lang' . EXT,
'think\Log' => CORE_PATH . 'Log' . EXT,
'think\log\driver\Browser' => CORE_PATH . 'log' . DS . 'driver' . DS . 'Browser' . EXT,
'think\log\driver\File' => CORE_PATH . 'log' . DS . 'driver' . DS . 'File' . EXT,
'think\log\driver\Sae' => CORE_PATH . 'log' . DS . 'driver' . DS . 'Sae' . EXT,
'think\log\driver\Socket' => CORE_PATH . 'log' . DS . 'driver' . DS . 'Socket' . EXT,
'think\log\driver\Trace' => CORE_PATH . 'log' . DS . 'driver' . DS . 'Trace' . EXT,
'think\Model' => CORE_PATH . 'Model' . EXT,
'think\model\Merge' => CORE_PATH . 'model' . DS . 'Merge' . EXT,
'think\model\Pivot' => CORE_PATH . 'model' . DS . 'Pivot' . EXT,

View File

@@ -10,6 +10,7 @@
// +----------------------------------------------------------------------
namespace think;
use think\exception\ClassNotFoundException;
/**
* Class Log
@@ -53,7 +54,11 @@ class Log
$class = false !== strpos($type, '\\') ? $type : '\\think\\log\\driver\\' . ucwords($type);
self::$config = $config;
unset($config['type']);
self::$driver = new $class($config);
if(class_exists($class)) {
self::$driver = new $class($config);
} else {
throw new ClassNotFoundException('class not exists:' . $class, $class);
}
// 记录初始化信息
App::$debug && Log::record('[ LOG ] INIT ' . $type . ': ' . var_export($config, true), 'info');
}