Skip to content

Commit 8b92e8d

Browse files
authored
Merge pull request #11 from bufferapp/task/use-bufflog
Use BuffLog for logging middleware requests
2 parents d7443f8 + 1824b57 commit 8b92e8d

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

middleware.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const createLogger = require('./logger');
1+
const bufflog = require('@bufferapp/bufflog');
22
const onFinished = require('on-finished');
33
const { getRequestDataToLog } = require('./lib/utils');
44

@@ -10,7 +10,6 @@ const { getRequestDataToLog } = require('./lib/utils');
1010
* @return {Function}
1111
*/
1212
module.exports = function middleware(options) {
13-
const logger = createLogger(options);
1413
const {
1514
getMetadata,
1615
getStats,
@@ -47,7 +46,11 @@ module.exports = function middleware(options) {
4746
stats,
4847
};
4948

50-
logger.info(info, msg);
49+
if (response.error) {
50+
bufflog.error(msg, info);
51+
} else {
52+
bufflog.info(msg, info);
53+
}
5154
});
5255

5356
next();

package.json

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@bufferapp/logger",
3-
"version": "0.9.0",
3+
"version": "1.0.2",
44
"description": "Logging for Buffer.com's node applications",
55
"main": "logger.js",
66
"scripts": {
@@ -21,9 +21,10 @@
2121
},
2222
"license": "MIT",
2323
"dependencies": {
24-
"bunyan": "1.8.1",
25-
"on-finished": "2.3.0",
26-
"fluent-logger": "2.2.0"
24+
"@bufferapp/bufflog": "0.0.4",
25+
"bunyan": "^1.8.12",
26+
"fluent-logger": "2.2.0",
27+
"on-finished": "2.3.0"
2728
},
2829
"devDependencies": {
2930
"chai": "^3.5.0",
@@ -33,7 +34,7 @@
3334
"eslint-plugin-jsx-a11y": "^1.2.3",
3435
"eslint-plugin-react": "^5.1.1",
3536
"istanbul": "^0.4.3",
36-
"mocha": "^2.5.3",
37+
"mocha": "^7.1.0",
3738
"msgpack-lite": "^0.1.26"
3839
}
3940
}

0 commit comments

Comments
 (0)