Compare commits

...

1 Commits

Author SHA1 Message Date
Rahul Padigela 9684ddf26d use hrtime to calculate timestamp 2016-09-29 12:42:22 -07:00
1 changed files with 5 additions and 1 deletions

View File

@ -203,6 +203,8 @@ class RequestLogger {
this.startTime = process.hrtime();
this.elapsedTime = null;
this._timestamp = Date.now();
}
/**
@ -434,6 +436,7 @@ class RequestLogger {
});
return;
}
let eMs;
const fields = objectCopy({}, this.fields, logFields || {});
const endFlag = isEnd || false;
@ -442,7 +445,8 @@ class RequestLogger {
* uses this field to generate ISO 8601 timestamp
*/
if (fields.time === undefined) {
fields.time = Date.now();
eMs = process.hrtime(this.startTime);
fields.time = this._timestamp + ( eMs[0] * 1000 + eMs[1] / 1000000);
}
fields.req_id = serializeUids(this.uids);