diff --git a/classmap.php b/classmap.php index a12636cc..7f3bc7fb 100644 --- a/classmap.php +++ b/classmap.php @@ -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, diff --git a/library/think/Log.php b/library/think/Log.php index 36388424..608910a0 100644 --- a/library/think/Log.php +++ b/library/think/Log.php @@ -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'); }