parent
f44fdd5e49
commit
57955edf22
@ -0,0 +1,41 @@ |
||||
<?php |
||||
// +---------------------------------------------------------------------- |
||||
// | ThinkPHP [ WE CAN DO IT JUST THINK IT ] |
||||
// +---------------------------------------------------------------------- |
||||
// | Copyright (c) 2006-2021 http://thinkphp.cn All rights reserved. |
||||
// +---------------------------------------------------------------------- |
||||
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) |
||||
// +---------------------------------------------------------------------- |
||||
// | Author: liu21st <liu21st@gmail.com> |
||||
// +---------------------------------------------------------------------- |
||||
declare (strict_types=1); |
||||
|
||||
namespace crmeb\utils; |
||||
|
||||
use think\contract\LogHandlerInterface; |
||||
use think\facade\Log; |
||||
|
||||
/** |
||||
* 本地化调试输出到文件 |
||||
*/ |
||||
class SqlLogHandle implements LogHandlerInterface |
||||
{ |
||||
/** |
||||
* 日志写入接口 |
||||
* @access public |
||||
* @param array $log 日志信息 |
||||
* @return bool |
||||
*/ |
||||
public function save(array $log): bool |
||||
{ |
||||
$logArray = array_chunk($log['sql'], 10); |
||||
foreach ($logArray as $array) { |
||||
// Log::write('sql', 'info', $array); |
||||
Log::write('sql', 'info'); |
||||
// Logger::getLogger()->system(false)->info('SqlLogHandle', $array); |
||||
} |
||||
return true; |
||||
} |
||||
|
||||
|
||||
} |
Loading…
Reference in new issue