Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

conflicting req/res scoped variable names #142

Copy link
Copy link
@WORMSS

Description

@WORMSS
Issue body actions

I read that you guys are thinking of a version 2.0 for morgan on one of the other issues..

I didn't see a 2.0 branch so I wasn't sure what your plans are, but I was wondering if you would be implementing the ES6 Symbol technique as to not conflict with any other express middleware that could be trying to store _startTime and such on req/res.

So some something like

const START_TIME = Symbol("startTime");
const START_AT = Symbol("startAt");
const REMOTE_ADDRESS = Symbol("remoteAddress");
....
function recordStartTime() {
  this[START_AT] = process.hrtime()
  this[START_TIME] = new Date()
}
...
// And expose the Symbols incase other modules may want to hook into morgan
module.exports.START_TIME = START_TIME;
module.exports.START_AT = START_TIME;
module.exports.REMOTE_ADDRESS  = REMOTE_ADDRESS;
  • Colin

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.