Skip to content

Commit

Permalink
restify#478 Add req.timers to audit logging plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
trentm committed Nov 26, 2013
1 parent e1bdd4e commit 0d7b4ba
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## Not Yet Released

- #478 Add `req.timers` to audit logging plugin.
- #487 RequestCaptureStream: dumpDefault, haveNonRawStreams, zero ring after dump
- #407 - bunyan 0.21.3
- Add CSV/TSV parser (Dominik Lessel)
Expand Down
10 changes: 9 additions & 1 deletion lib/plugins/audit.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@ function auditLogger(options) {
if (!req)
return (false);

var timers = {};
(req.timers || []).forEach(function (time) {
var t = time.time;
var _t = Math.floor((1000000 * t[0]) +
(t[1] / 1000));
timers[time.name] = _t;
});
return ({
method: req.method,
url: req.url,
Expand All @@ -39,7 +46,8 @@ function auditLogger(options) {
trailers: req.trailers,
version: req.version,
body: options.body === true ?
req.body : undefined
req.body : undefined,
timers: timers
});
},
res: function auditResponseSerializer(res) {
Expand Down

0 comments on commit 0d7b4ba

Please sign in to comment.