Skip to content

Commit

Permalink
Fix quotes in Readme.md for Google Logging
Browse files Browse the repository at this point in the history
  • Loading branch information
yinzara authored Sep 30, 2019
1 parent 565cf5c commit e50d725
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -336,8 +336,8 @@ app.use(expressWinston.logger({
transports: [new LoggingWinston({})],
metaField: null, //this causes the metadata to be stored at the root of the log entry
responseField: null, // this prevents the response from being included in the metadata (including body and status code)
requestWhitelist: ["headers", "query"], //these are not included in the standard StackDriver httpRequest
responseWhitelist: ["body"], // this populates the `res.body` so we can get the response size (not required)
requestWhitelist: ['headers', 'query'], //these are not included in the standard StackDriver httpRequest
responseWhitelist: ['body'], // this populates the `res.body` so we can get the response size (not required)
dynamicMeta: (req, res) => {
const httpRequest = {}
const meta = {}
Expand All @@ -349,8 +349,8 @@ app.use(expressWinston.logger({
// httpRequest.remoteIp = req.ip // this includes both ipv6 and ipv4 addresses separated by ':'
httpRequest.remoteIp = req.ip.indexOf(':') >= 0 ? req.ip.substring(req.ip.lastIndexOf(':') + 1) : req.ip // just ipv4
httpRequest.requestSize = req.socket.bytesRead
httpRequest.userAgent = req.get("User-Agent")
httpRequest.referrer = req.get("Referrer")
httpRequest.userAgent = req.get('User-Agent')
httpRequest.referrer = req.get('Referrer')
}

if (res) {
Expand All @@ -361,17 +361,16 @@ app.use(expressWinston.logger({
nanos: ( res.responseTime % 1000 ) * 1000000
}
if (res.body) {
if (typeof res.body === "object") {
if (typeof res.body === 'object') {
httpRequest.responseSize = JSON.stringify(res.body).length
} else if (typeof res.body === "string") {
} else if (typeof res.body === 'string') {
httpRequest.responseSize = res.body.length
}
}
}
return meta
}
}));

```

## Global Whitelists and Blacklists
Expand Down

0 comments on commit e50d725

Please sign in to comment.