Skip to content

Commit 93e5779

Browse files
committed
fix: fixed app log emitter
1 parent 03a0b1e commit 93e5779

File tree

3 files changed

+190
-257
lines changed

3 files changed

+190
-257
lines changed

index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,9 @@ class API {
5757
const app = new Koa();
5858

5959
// listen for error and log events emitted by app
60-
app.on('error', (err, ctx) => ctx.logger.error(err));
60+
app.on('error', (err, ctx) => {
61+
ctx.logger[err.status && err.status < 500 ? 'warn' : 'error'](err);
62+
});
6163
app.on('log', logger.log);
6264

6365
// initialize redis

package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
"cabin": "^8.0.2",
3030
"express-request-id": "^1.4.1",
3131
"kcors": "^2.2.2",
32-
"koa": "^2.12.1",
32+
"koa": "^2.13.0",
3333
"koa-404-handler": "^0.0.2",
3434
"koa-basic-auth": "^4.0.0",
3535
"koa-better-error-handler": "^4.0.3",
@@ -47,20 +47,20 @@
4747
"response-time": "^2.3.2"
4848
},
4949
"devDependencies": {
50-
"@commitlint/cli": "^8.3.5",
51-
"@commitlint/config-conventional": "^8.3.4",
50+
"@commitlint/cli": "^9.0.1",
51+
"@commitlint/config-conventional": "^9.0.1",
5252
"ava": "^3.9.0",
5353
"codecov": "^3.7.0",
5454
"cross-env": "^7.0.2",
5555
"eslint": "6.x",
5656
"eslint-config-xo-lass": "^1.0.3",
5757
"fixpack": "^3.0.6",
5858
"husky": "^4.2.5",
59-
"lint-staged": "10.2.10",
59+
"lint-staged": "10.2.11",
6060
"mongoose": "^5.9.19",
6161
"nyc": "^15.1.0",
6262
"remark-cli": "^8.0.0",
63-
"remark-preset-github": "^1.0.1",
63+
"remark-preset-github": "^2.0.0",
6464
"supertest": "^4.0.2",
6565
"xo": "0.25"
6666
},

0 commit comments

Comments
 (0)