mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-01 20:52:48 +08:00
38 lines
1.4 KiB
PHP
38 lines
1.4 KiB
PHP
<?php
|
|
// +----------------------------------------------------------------------
|
|
// | TOPThink [ WE CAN DO IT JUST THINK ]
|
|
// +----------------------------------------------------------------------
|
|
// | Copyright (c) 2011 http://topthink.com All rights reserved.
|
|
// +----------------------------------------------------------------------
|
|
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
|
|
// +----------------------------------------------------------------------
|
|
// | Author: liu21st <liu21st@gmail.com>
|
|
// +----------------------------------------------------------------------
|
|
|
|
namespace Think;
|
|
class Log {
|
|
|
|
static protected $handler = null;
|
|
|
|
// 日志初始化
|
|
static public function init($config=[]){
|
|
if(!empty($config['type'])) { // 读取log驱动
|
|
$class = 'Think\\Log\\Driver\\'. ucwords(strtolower($config['type']));
|
|
// 检查驱动类
|
|
if(class_exists($class)) {
|
|
unset($config['type']);
|
|
self::$handler = new $class($config);
|
|
return self::$handler;
|
|
}else {
|
|
// 类没有定义
|
|
throw_exception(Lang::get('_CLASS_NOT_EXIST_').': ' . $class);
|
|
}
|
|
}
|
|
}
|
|
|
|
// 调用驱动类的方法
|
|
public static function __callStatic($method, $params){
|
|
return call_user_func_array(array(self::$handler, $method), $params);
|
|
}
|
|
|
|
} |