Skip to content

Commit 544717c

Browse files
authored
Merge pull request #204 from fedwiki/log-fix
fix logger issue
2 parents 58726ca + ba5d2a8 commit 544717c

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

lib/server.js

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -256,10 +256,22 @@ export default async argv => {
256256

257257
// use logger, at least in development, probably needs a param to configure (or turn off).
258258
// use stream to direct to somewhere other than stdout.
259-
logger.token('vhost', (req, res) => {
260-
return colorString(wikiName)
261-
})
262-
app.use(logger(':vhost :method :url :status :res[content-length] - :response-time ms'))
259+
const vhost = colorString(wikiName)
260+
app.use(
261+
logger((tokens, req, res) => {
262+
return [
263+
vhost,
264+
tokens.method(req, res),
265+
tokens.url(req, res),
266+
tokens.status(req, res),
267+
tokens.res(req, res, 'content-length'),
268+
'-',
269+
tokens['response-time'](req, res),
270+
'ms',
271+
].join(' ')
272+
}),
273+
)
274+
263275
app.use(cookieParser())
264276
app.use(bodyParser.json({ limit: argv.uploadLimit }))
265277
app.use(bodyParser.urlencoded({ extended: true, limit: argv.uploadLimit }))

0 commit comments

Comments
 (0)