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
Add request/response logging middleware #322
Conversation
Current log format in development:
|
* origin/master: Fix two 404s to the API docs (#344) Add `context.log` to add event context to each log message (#321) fix(package): update github to version 12.0.3 (#340) chore(packaging): Remove semantic-release from CI (#341) refactor: switch ejs for hbs fix: Move unhandled rejection listener to cli scripts (#339) chore: Move index.js into lib/ (#338) Add option to develop Probot on Glitch (#306) refactor: absorb github-app chore: Setup Appveyor (#334) docs: Replace examples with include from website (#327)
…to request-logging * 'request-logging' of https://github.com/probot/probot: Round response time to 2 digits Load serializers for tests Fix linting Include request in response log Move req/res serializers # Conflicts: # lib/index.js
lib/serializers.js
Outdated
}, | ||
|
||
// Same as buyan's standard serializers, but gets headers as an object | ||
// instead of a string. |
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.
Suuuuuper nitpicky, but there's an extra space here 😎
@@ -209,28 +209,3 @@ module.exports = (...args) => new Robot(...args) | |||
* @typedef github | |||
* @see {@link https://github.com/mikedeboer/node-github} |
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.
This is unrelated to your current work, but we should update this link.
This means all log messages tied to a request or webhook will have the same `id` attribute, allowing you to filter logs by the id.
Ok, calling this good enough. I'd love a set of eyes. Here's the current default Setting
|
I'm not sure why the PR status is not updating, because it is passing. |
* origin/master: Add example to README (#361) Enable Codecov (#360) Implement GHE Support (#331) refactor: Extract Sentry logging to a built-in plugin (#353) Log full requests as trace (#352) Improve GitHub logging (#351) General cleanup (#350) doc: Logging (#348) feat: Add request/response logging (#322) fix: Improve log messages for localtunnel (#349) # Conflicts: # lib/index.js # lib/robot.js # test/robot.test.js
This PR is part of a series of changes to improve logging support in Probot: #320
This is an alternative to #270 and #314. It has the following advantages:
X-Request-ID
in the response, which is a value either provided by the client in the request or generated. This allows tracing of errors by request by searching forreq.headers.x-request-id
and the value of the request id.req.log
which will includeX-Request-ID
in all log messagesTODO:
context.log
to add event context to each log message #321 merges, update this to uselib/logging.js
and wrap the logger onreq.log
so it can be called asreq.log(foo)
orreq.log.trace(foo)
req
andres
serializers intolib/serializers.js
LOG_LEVEL=info