You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
1.2 KiB
41 lines
1.2 KiB
<?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;
|
|
}
|
|
|
|
|
|
}
|
|
|