mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-09-02 21:41:36 +08:00
测试
This commit is contained in:
38
Think/Log.php
Normal file
38
Think/Log.php
Normal file
@@ -0,0 +1,38 @@
|
||||
<?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);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user