mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-06 23:02:48 +08:00
@@ -268,8 +268,6 @@ class Error
|
|||||||
'DS' => defined('DS') ? DS : 'undefined',
|
'DS' => defined('DS') ? DS : 'undefined',
|
||||||
'__INFO__' => defined('__INFO__') ? __INFO__ : 'undefined',
|
'__INFO__' => defined('__INFO__') ? __INFO__ : 'undefined',
|
||||||
'__EXT__' => defined('__EXT__') ? __EXT__ : 'undefined',
|
'__EXT__' => defined('__EXT__') ? __EXT__ : 'undefined',
|
||||||
'__INFO__' => defined('__INFO__') ? __INFO__ : 'undefined',
|
|
||||||
'__EXT__' => defined('__EXT__') ? __EXT__ : 'undefined',
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ class Log
|
|||||||
unset($config['type']);
|
unset($config['type']);
|
||||||
self::$driver = new $class($config);
|
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']);
|
unset($config['type']);
|
||||||
self::$alarm = new $class($config['alarm']);
|
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
|
* @return void
|
||||||
*/
|
*/
|
||||||
public static function send($msg)
|
public static function send($msg)
|
||||||
|
|||||||
@@ -1,2 +0,0 @@
|
|||||||
*
|
|
||||||
!.gitignore
|
|
||||||
34
tests/thinkphp/library/think/log/driver/fileTest.php
Normal file
34
tests/thinkphp/library/think/log/driver/fileTest.php
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
<?php
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Copyright (c) 2006~2016 http://thinkphp.cn All rights reserved.
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Author: liu21st <liu21st@gmail.com>
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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));
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user