-
-
Notifications
You must be signed in to change notification settings - Fork 28
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
Provide a chapter on adding a request ID #84
Provide a chapter on adding a request ID #84
Conversation
However, when using mezzio-swoole, the request handler runner we create is your web server. | ||
It has listeners that take care of logging, which means that the request generated must _already_ have the identifier if you want to be able to log it. | ||
|
||
This poses a problem: normally you will use middleware to propagate changes to the request. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Until here the problem is described, therefore the the headline "The solution" is wrong before these lines.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated.
This poses a problem: normally you will use middleware to propagate changes to the request. | ||
How can you do it at the Swoole web server level? | ||
|
||
The answer is deceptively simple: you can provide a [delegator factory](https://docs.mezzio.dev/mezzio/v3/features/container/delegator-factories/) for decorator on the service that converts the Swoole HTTP request instance into the equivalent [PSR-7](https://www.php-fig.org/psr/psr-7/) HTTP request instance that is then passed to your application. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe it is simple for you but it does not mean that it applies to others as well. So do not use "simple" or "easy" in the documentation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated.
Based on a question I answered in Slack, this provides a recipe for adding a unique request ID that can then be tracked in your logs. Signed-off-by: Matthew Weier O'Phinney <matthew@weierophinney.net>
Signed-off-by: Matthew Weier O'Phinney <matthew@weierophinney.net>
- Move description of the problem... under the heading marked "The problem". - Remove "simple" verbiage. Signed-off-by: Matthew Weier O'Phinney <matthew@weierophinney.net>
Performs one more editing pass, identifying several grammatical and/or spelling errors. Also updates the example to use an arrow function. Signed-off-by: Matthew Weier O'Phinney <matthew@weierophinney.net>
52d7c2b
to
5169788
Compare
Based on a question I answered in Slack, this provides a recipe for adding a unique request ID that can then be tracked in your logs.