mirror of
https://gitee.com/ulthon/ulthon_admin.git
synced 2026-07-07 10:32:48 +08:00
feat: 发布智能体版
This commit is contained in:
@@ -110,32 +110,39 @@ class DebugMysql implements LogHandlerInterface
|
||||
$log_key = uniqid();
|
||||
}
|
||||
|
||||
foreach ($log as $log_level => $log_list) {
|
||||
foreach ($log_list as $key => $log_item) {
|
||||
if (!is_string($log_item)) {
|
||||
$log_item = print_r($log_item, true);
|
||||
}
|
||||
foreach ($log as $log_item) {
|
||||
// 适配 ThinkPHP 8.x 的 LogRecord 对象格式
|
||||
// 兼容旧格式:包含 type 和 message 属性的对象
|
||||
if (is_object($log_item) && isset($log_item->type) && isset($log_item->message)) {
|
||||
$log_level = $log_item->type;
|
||||
$log_content = $log_item->message;
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
|
||||
$log_data = [
|
||||
'level' => $log_level,
|
||||
'content' => $log_item,
|
||||
'create_time' => $create_time,
|
||||
'create_time_title' => $create_time_title,
|
||||
'uid' => $log_key,
|
||||
'app_name' => $app_name,
|
||||
'controller_name' => $controller_name,
|
||||
'action_name' => $action_name,
|
||||
];
|
||||
if (!is_string($log_content)) {
|
||||
$log_content = print_r($log_content, true);
|
||||
}
|
||||
|
||||
try {
|
||||
if (!is_null($this->pdo)) {
|
||||
$this->saveByConnect($log_data);
|
||||
} else {
|
||||
$this->saveByFile($log_data);
|
||||
}
|
||||
} catch (\Throwable $th) {
|
||||
$log_data = [
|
||||
'level' => $log_level,
|
||||
'content' => $log_content,
|
||||
'create_time' => $create_time,
|
||||
'create_time_title' => $create_time_title,
|
||||
'uid' => $log_key,
|
||||
'app_name' => $app_name,
|
||||
'controller_name' => $controller_name,
|
||||
'action_name' => $action_name,
|
||||
];
|
||||
|
||||
try {
|
||||
if (!is_null($this->pdo)) {
|
||||
$this->saveByConnect($log_data);
|
||||
} else {
|
||||
$this->saveByFile($log_data);
|
||||
}
|
||||
} catch (\Throwable $th) {
|
||||
$this->saveByFile($log_data);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -242,7 +249,7 @@ class DebugMysql implements LogHandlerInterface
|
||||
$dirname = dirname($log_path);
|
||||
|
||||
if (!is_dir($dirname)) {
|
||||
mkdir($log_path, 0777, true);
|
||||
mkdir($dirname, 0777, true);
|
||||
}
|
||||
|
||||
$first_line = false;
|
||||
|
||||
Reference in New Issue
Block a user