@samitouri / QOSami-HFS / commits / 3e020b9b

small optimization

Massimo Melina committed Dec 20, 2023 at 16:57 UTC 3e020b9b907197484ebe149927e2bf5bf60c45d8
1 file changed +1 -1
src/log.ts
+1 -1
@@ -112,7 +112,7 @@ export const logMw: Koa.Middleware = async (ctx, next) => {
112 if (conn?.country)
113 ctx.logExtra({ country: conn.country })
114 if (logUA.get())
115 - ctx.logExtra({ ua: ctx.get('user-agent') })
115 + ctx.logExtra({ ua: ctx.get('user-agent') || undefined })
116 const extra = ctx.state.logExtra
117 events.emit(logger.name, Object.assign(_.pick(ctx, ['ip', 'method','status']), { length, user, ts: now, uri, extra }))
118 debounce(() => // once in a while we check if the file is still good (not deleted, etc), or we'll reopen it