Skip to content

Commit

Permalink
fix: fixed logger to return object, bump deps
Browse files Browse the repository at this point in the history
  • Loading branch information
niftylettuce committed May 26, 2020
1 parent 7a6bf9e commit d57a6f8
Show file tree
Hide file tree
Showing 5 changed files with 1,082 additions and 1,206 deletions.
7 changes: 7 additions & 0 deletions .lintstagedrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = {
"*.md": [
filenames => filenames.map(filename => `remark ${filename} -qfo`)
],
'package.json': 'fixpack',
'*.js': 'xo --fix'
};
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
language: node_js
node_js:
- '8'
- '10'
- '12'
- 'lts/*'
Expand Down
53 changes: 18 additions & 35 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@
"author": "Nick Baugh <[email protected]> (http://niftylettuce.com/)",
"ava": {
"failFast": true,
"verbose": true,
"helpers": [
"test/helpers/**/*"
]
"verbose": true
},
"browser": {
"./src/middleware": false,
Expand All @@ -28,50 +25,50 @@
],
"dependencies": {
"ansi-colors": "^4.1.1",
"axe": "^5.0.1",
"clf-date": "^0.1.0",
"axe": "^5.1.0",
"clf-date": "^0.2.0",
"iserror": "^0.0.2",
"ms": "^2.1.2",
"on-finished": "^2.3.0",
"parse-err": "^0.0.12",
"parse-request": "^2.0.6"
},
"devDependencies": {
"@babel/cli": "^7.8.4",
"@babel/core": "^7.9.0",
"@babel/preset-env": "^7.9.5",
"@babel/cli": "^7.10.0",
"@babel/core": "^7.10.0",
"@babel/preset-env": "^7.10.0",
"@commitlint/cli": "^8.3.5",
"@commitlint/config-conventional": "^8.3.4",
"ava": "2.x",
"ava": "^3.8.2",
"babelify": "^10.0.0",
"browserify": "^16.5.1",
"codecov": "^3.6.5",
"cross-env": "6.x",
"eslint": "^6.8.0",
"codecov": "^3.7.0",
"cross-env": "^7.0.2",
"eslint": "6.x",
"eslint-config-xo-lass": "^1.0.3",
"eslint-plugin-compat": "^3.5.1",
"eslint-plugin-compat": "^3.7.0",
"eslint-plugin-node": "^11.1.0",
"express": "^4.17.1",
"express-request-id": "^1.4.1",
"fixpack": "^3.0.6",
"husky": "3.x",
"jsdom": "15.2.1",
"koa": "^2.11.0",
"husky": "^4.2.5",
"jsdom": "15.x",
"koa": "^2.12.0",
"koa-connect": "^2.0.1",
"koa-router": "^8.0.8",
"lint-staged": "^10.1.5",
"lint-staged": "^10.2.6",
"lodash": "^4.17.15",
"nyc": "^15.0.1",
"pino": "^6.2.0",
"pino": "^6.3.0",
"remark-cli": "^8.0.0",
"remark-preset-github": "^1.0.0",
"remark-preset-github": "^1.0.1",
"request-received": "^0.0.3",
"response-time": "^2.3.2",
"rimraf": "^3.0.2",
"signale": "^1.4.0",
"supertest": "^4.0.2",
"tinyify": "^2.5.2",
"uglify-js": "^3.9.1",
"uglify-js": "^3.9.3",
"xo": "0.25"
},
"engines": {
Expand Down Expand Up @@ -146,20 +143,6 @@
"winston"
],
"license": "MIT",
"lint-staged": {
"*.js": [
"xo --fix",
"git add"
],
"*.md": [
"remark . -qfo",
"git add"
],
"package.json": [
"fixpack",
"git add"
]
},
"main": "lib/index.js",
"prettier": {
"singleQuote": true,
Expand Down
9 changes: 6 additions & 3 deletions src/middleware.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ module.exports = function(...args) {
Object.keys(this.logger)
.filter(key => isFunction(this.logger[key]))
.forEach(key => {
logger[key] = (...params) => {
const _logger = this.logger[key];
this.logger[key] = (...params) => {
if (isUndefined(params[1])) params[1] = {};
else params[1] = this.parseArg(params[1]);
// add `request` object to metadata
Expand Down Expand Up @@ -49,7 +50,7 @@ module.exports = function(...args) {
// <https://github.com/nodejs/node/issues/28302>
//
// note that HTTP2 responses do not have a String value
// for `res._header`, and instad is a Boolean value
// for `res._header`, and instead is a Boolean value
// <https://github.com/nodejs/node/issues/30894>
// <https://github.com/cabinjs/cabin/issues/133>
{
Expand All @@ -65,8 +66,10 @@ module.exports = function(...args) {
)
);

this.logger[key](...[].slice.call(params));
return _logger(...[].slice.call(params));
};

logger[key] = this.logger[key];
});
// upon completion of a response we need to log it
onFinished(res, err => {
Expand Down
Loading

0 comments on commit d57a6f8

Please sign in to comment.