refactor: 规范MysqlLogger代码

This commit is contained in:
xboard 2023-11-20 09:37:22 +08:00
parent 907ccebfdf
commit bc80d7e91c

View File

@ -31,15 +31,15 @@ class MysqlLoggerHandler extends AbstractProcessingHandler
'ip' => request()->getClientIp(), 'ip' => request()->getClientIp(),
'data' => json_encode($record['request_data']) , 'data' => json_encode($record['request_data']) ,
'context' => isset($record['context']) ? json_encode($record['context']) : '', 'context' => isset($record['context']) ? json_encode($record['context']) : '',
'created_at' => strtotime($record['datetime']), 'created_at' => $record['datetime']->getTimestamp(),
'updated_at' => strtotime($record['datetime']), 'updated_at' => $record['datetime']->getTimestamp(),
]; ];
LogModel::insert( LogModel::insert(
$log $log
); );
}catch (\Exception $e){ }catch (\Exception $e){
Log::channel('daily')->error($e->getMessage().$e->getFile().$e->getTraceAsString()); // Log::channel('daily')->error($e->getMessage().$e->getFile().$e->getTraceAsString());
} }
} }
} }