diff --git a/library/think/Error.php b/library/think/Error.php index d62f68cb..e7c96c45 100644 --- a/library/think/Error.php +++ b/library/think/Error.php @@ -268,8 +268,6 @@ class Error 'DS' => defined('DS') ? DS : 'undefined', '__INFO__' => defined('__INFO__') ? __INFO__ : 'undefined', '__EXT__' => defined('__EXT__') ? __EXT__ : 'undefined', - '__INFO__' => defined('__INFO__') ? __INFO__ : 'undefined', - '__EXT__' => defined('__EXT__') ? __EXT__ : 'undefined', ]; } } diff --git a/library/think/Log.php b/library/think/Log.php index 4178a321..cf7c13a8 100644 --- a/library/think/Log.php +++ b/library/think/Log.php @@ -37,7 +37,7 @@ class Log unset($config['type']); self::$driver = new $class($config); // 记录初始化信息 - APP_DEBUG && Log::record('[ LOG ] INIT ' . $type . ':' . var_export($config, true), 'info'); + APP_DEBUG && Log::record('[ LOG ] INIT ' . $type . ': ' . var_export($config, true), 'info'); } // 通知初始化 @@ -48,7 +48,7 @@ class Log unset($config['type']); self::$alarm = new $class($config['alarm']); // 记录初始化信息 - APP_DEBUG && Log::record('[ CACHE ] ALARM ' . $type . ':' . var_export($config, true), 'info'); + APP_DEBUG && Log::record('[ CACHE ] ALARM ' . $type . ': ' . var_export($config, true), 'info'); } /** @@ -111,6 +111,7 @@ class Log /** * 发送预警通知 + * @param mixed $msg 调试信息 * @return void */ public static function send($msg) diff --git a/tests/thinkphp/library/think/log/driver/.gitignore b/tests/thinkphp/library/think/log/driver/.gitignore deleted file mode 100644 index a3a0c8b5..00000000 --- a/tests/thinkphp/library/think/log/driver/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -* -!.gitignore \ No newline at end of file diff --git a/tests/thinkphp/library/think/log/driver/fileTest.php b/tests/thinkphp/library/think/log/driver/fileTest.php new file mode 100644 index 00000000..168ef81a --- /dev/null +++ b/tests/thinkphp/library/think/log/driver/fileTest.php @@ -0,0 +1,34 @@ + +// +---------------------------------------------------------------------- + +/** + * Test File Log + */ +namespace tests\thinkphp\library\think\log\driver; + +use think\Log; + +class fileTest extends \PHPUnit_Framework_TestCase +{ + protected function setUp() + { + Log::init(['type' => 'file']); + } + + public function testRecord() + { + $record_msg = 'record'; + Log::record($record_msg, 'notice'); + $logs = Log::getLog(); + + $this->assertNotFalse(array_search(['type' => 'notice', 'msg' => $record_msg], $logs)); + } +}