Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

【question】 如何使用这个工具记录api请求日志 #5

Open
askme-gpt opened this issue Aug 19, 2020 · 0 comments
Open

【question】 如何使用这个工具记录api请求日志 #5

askme-gpt opened this issue Aug 19, 2020 · 0 comments

Comments

@askme-gpt
Copy link

easyswoole : 3.3.7
swoole : 4.5.1
php: 7.3

    public static function onRequest(Request $request, Response $response): bool
    {
        //链路追踪
        $point = PointContext::getInstance()->createStart('onRequest');
        $point->setStartArg([
            'uri' => $request->getUri()->__toString(), //获取请求的url
            'params' => $request->getRequestParam(),   //post参数
        ]);
       return true;
    }

    public static function afterRequest(Request $request, Response $response): void
    {
        $point = PointContext::getInstance()->startPoint();
        $point->end();
        $array = Point::toArray($point);  //这里面获取不到请求结果信息
        dumps($response->getBody()->__toString());
    }

Point::toArray($point)获取不到请求结果,这里应如何使用呢?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant