make logger great again

This commit is contained in:
syuilo 2018-04-19 18:03:46 +09:00
parent d87e3a0ee3
commit 45b6a6bc54
2 changed files with 9 additions and 0 deletions

View file

@ -56,6 +56,7 @@
"@types/koa-bodyparser": "4.2.0", "@types/koa-bodyparser": "4.2.0",
"@types/koa-compress": "^2.0.8", "@types/koa-compress": "^2.0.8",
"@types/koa-favicon": "2.0.19", "@types/koa-favicon": "2.0.19",
"@types/koa-logger": "^3.1.0",
"@types/koa-mount": "3.0.1", "@types/koa-mount": "3.0.1",
"@types/koa-multer": "1.0.0", "@types/koa-multer": "1.0.0",
"@types/koa-router": "7.0.27", "@types/koa-router": "7.0.27",
@ -141,6 +142,7 @@
"koa-compress": "3.0.0", "koa-compress": "3.0.0",
"koa-favicon": "2.0.1", "koa-favicon": "2.0.1",
"koa-json-body": "^5.3.0", "koa-json-body": "^5.3.0",
"koa-logger": "^3.2.0",
"koa-mount": "3.0.0", "koa-mount": "3.0.0",
"koa-multer": "1.0.2", "koa-multer": "1.0.2",
"koa-router": "7.4.0", "koa-router": "7.4.0",

View file

@ -10,6 +10,7 @@ import * as Koa from 'koa';
import * as Router from 'koa-router'; import * as Router from 'koa-router';
import * as mount from 'koa-mount'; import * as mount from 'koa-mount';
import * as compress from 'koa-compress'; import * as compress from 'koa-compress';
import * as logger from 'koa-logger';
import activityPub from './activitypub'; import activityPub from './activitypub';
import webFinger from './webfinger'; import webFinger from './webfinger';
@ -19,6 +20,12 @@ import config from '../config';
const app = new Koa(); const app = new Koa();
app.proxy = true; app.proxy = true;
if (process.env.NODE_ENV != 'production') {
// Logger
app.use(logger());
}
// Compress response
app.use(compress({ app.use(compress({
flush: zlib.constants.Z_SYNC_FLUSH flush: zlib.constants.Z_SYNC_FLUSH
})); }));