Commit 7c96ec43 authored by Liu lu's avatar Liu lu

异步日志http参数记录

parent 8be156e2
...@@ -4,6 +4,7 @@ namespace Meibuyu\Micro\Aspect; ...@@ -4,6 +4,7 @@ namespace Meibuyu\Micro\Aspect;
use Hyperf\Di\Annotation\Aspect; use Hyperf\Di\Annotation\Aspect;
use Hyperf\Di\Aop\AbstractAspect; use Hyperf\Di\Aop\AbstractAspect;
use Hyperf\Di\Aop\ProceedingJoinPoint; use Hyperf\Di\Aop\ProceedingJoinPoint;
use Hyperf\HttpServer\Contract\RequestInterface;
use Meibuyu\Micro\Annotation\LogTrace; use Meibuyu\Micro\Annotation\LogTrace;
use Meibuyu\Micro\Handler\LogTrace\LogTraceHandler; use Meibuyu\Micro\Handler\LogTrace\LogTraceHandler;
...@@ -25,9 +26,14 @@ class LogTraceAspect extends AbstractAspect ...@@ -25,9 +26,14 @@ class LogTraceAspect extends AbstractAspect
public function process(ProceedingJoinPoint $proceedingJoinPoint) public function process(ProceedingJoinPoint $proceedingJoinPoint)
{ {
$originParams = [
'called_params'=>$proceedingJoinPoint->getArguments(),
'http_params'=>make(RequestInterface::class)->all()
];
LogTraceHandler::createLogTrace( LogTraceHandler::createLogTrace(
$proceedingJoinPoint->className.'@'.$proceedingJoinPoint->methodName, $proceedingJoinPoint->className.'@'.$proceedingJoinPoint->methodName,
$proceedingJoinPoint->getArguments() $originParams
); );
$result = $proceedingJoinPoint->process(); $result = $proceedingJoinPoint->process();
LogTraceHandler::recordProcess('返回结果:'.json_encode($result)); LogTraceHandler::recordProcess('返回结果:'.json_encode($result));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment