@sprucelabs/log
Advanced tools
Comparing version 1.1.0 to 1.2.0
@@ -222,6 +222,7 @@ // | ||
trackLog(level , args ) {} | ||
trackLog(level , args ) { | ||
this.metric(`log-${level}`); | ||
} | ||
trace() { | ||
this.trackLog('trace', arguments); | ||
this.doLog('trace', arguments); | ||
@@ -231,3 +232,2 @@ } | ||
debug() { | ||
this.trackLog('debug', arguments); | ||
this.doLog('debug', arguments); | ||
@@ -237,3 +237,2 @@ } | ||
log() { | ||
this.trackLog('log', arguments); | ||
this.doLog('log', arguments); | ||
@@ -243,3 +242,2 @@ } | ||
info() { | ||
this.trackLog('info', arguments); | ||
this.doLog('info', arguments); | ||
@@ -269,5 +267,4 @@ } | ||
superInfo() { | ||
this.trackLog('superInfo', arguments); | ||
this.doLog('superInfo', arguments); | ||
} | ||
}; |
@@ -18,4 +18,8 @@ module.exports = () => { | ||
} | ||
const startHrTime = process.hrtime(); | ||
res.on('finish', () => { | ||
const elapsedHrTime = process.hrtime(startHrTime); | ||
const elapsedTimeInMs = elapsedHrTime[0] * 1000 + elapsedHrTime[1] / 1e6; | ||
log.metric({ | ||
@@ -30,3 +34,4 @@ type: 'httpRequest', | ||
userAgent: req.headers['user-agent'], | ||
ip: req.headers['x-forwarded-for'] || (req.connection && req.connection.remoteAddress) | ||
ip: req.headers['x-forwarded-for'] || (req.connection && req.connection.remoteAddress), | ||
milliseconds: elapsedTimeInMs | ||
}); | ||
@@ -33,0 +38,0 @@ }); |
@@ -307,7 +307,8 @@ "use strict"; | ||
key: "trackLog", | ||
value: function trackLog(level, args) {} | ||
value: function trackLog(level, args) { | ||
this.metric("log-".concat(level)); | ||
} | ||
}, { | ||
key: "trace", | ||
value: function trace() { | ||
this.trackLog('trace', arguments); | ||
this.doLog('trace', arguments); | ||
@@ -318,3 +319,2 @@ } | ||
value: function debug() { | ||
this.trackLog('debug', arguments); | ||
this.doLog('debug', arguments); | ||
@@ -325,3 +325,2 @@ } | ||
value: function log() { | ||
this.trackLog('log', arguments); | ||
this.doLog('log', arguments); | ||
@@ -332,3 +331,2 @@ } | ||
value: function info() { | ||
this.trackLog('info', arguments); | ||
this.doLog('info', arguments); | ||
@@ -363,3 +361,2 @@ } | ||
value: function superInfo() { | ||
this.trackLog('superInfo', arguments); | ||
this.doLog('superInfo', arguments); | ||
@@ -366,0 +363,0 @@ } |
@@ -21,3 +21,6 @@ "use strict"; | ||
var startHrTime = process.hrtime(); | ||
res.on('finish', function () { | ||
var elapsedHrTime = process.hrtime(startHrTime); | ||
var elapsedTimeInMs = elapsedHrTime[0] * 1000 + elapsedHrTime[1] / 1e6; | ||
log.metric({ | ||
@@ -32,3 +35,4 @@ type: 'httpRequest', | ||
userAgent: req.headers['user-agent'], | ||
ip: req.headers['x-forwarded-for'] || req.connection && req.connection.remoteAddress | ||
ip: req.headers['x-forwarded-for'] || req.connection && req.connection.remoteAddress, | ||
milliseconds: elapsedTimeInMs | ||
}); | ||
@@ -35,0 +39,0 @@ }); |
@@ -0,1 +1,8 @@ | ||
# [1.2.0](https://github.com/sprucelabsai/sprucebot-log/compare/v1.1.0...v1.2.0) (2018-10-19) | ||
### Features | ||
* capture ms on requests ([33f4c90](https://github.com/sprucelabsai/sprucebot-log/commit/33f4c90)) | ||
# [1.1.0](https://github.com/sprucelabsai/sprucebot-log/compare/v1.0.4...v1.1.0) (2018-10-19) | ||
@@ -2,0 +9,0 @@ |
{ | ||
"name": "@sprucelabs/log", | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"publishConfig": { | ||
@@ -5,0 +5,0 @@ "access": "public", |
@@ -222,6 +222,7 @@ // @flow | ||
trackLog(level: string, args: any) {} | ||
trackLog(level: string, args: any) { | ||
this.metric(`log-${level}`); | ||
} | ||
trace() { | ||
this.trackLog('trace', arguments); | ||
this.doLog('trace', arguments); | ||
@@ -231,3 +232,2 @@ } | ||
debug() { | ||
this.trackLog('debug', arguments); | ||
this.doLog('debug', arguments); | ||
@@ -237,3 +237,2 @@ } | ||
log() { | ||
this.trackLog('log', arguments); | ||
this.doLog('log', arguments); | ||
@@ -243,3 +242,2 @@ } | ||
info() { | ||
this.trackLog('info', arguments); | ||
this.doLog('info', arguments); | ||
@@ -269,5 +267,4 @@ } | ||
superInfo() { | ||
this.trackLog('superInfo', arguments); | ||
this.doLog('superInfo', arguments); | ||
} | ||
}; |
@@ -18,4 +18,8 @@ module.exports = () => { | ||
} | ||
const startHrTime = process.hrtime(); | ||
res.on('finish', () => { | ||
const elapsedHrTime = process.hrtime(startHrTime); | ||
const elapsedTimeInMs = elapsedHrTime[0] * 1000 + elapsedHrTime[1] / 1e6; | ||
log.metric({ | ||
@@ -30,3 +34,4 @@ type: 'httpRequest', | ||
userAgent: req.headers['user-agent'], | ||
ip: req.headers['x-forwarded-for'] || (req.connection && req.connection.remoteAddress) | ||
ip: req.headers['x-forwarded-for'] || (req.connection && req.connection.remoteAddress), | ||
milliseconds: elapsedTimeInMs | ||
}); | ||
@@ -33,0 +38,0 @@ }); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
311855
2659