[koa-pino-logger] add context variable used for manual logging (#29506)

This commit is contained in:
Andrew Marcuse
2018-10-12 13:09:10 -04:00
committed by Andy
parent 44cae14975
commit 42f021f35e
2 changed files with 11 additions and 0 deletions

View File

@@ -26,3 +26,9 @@ declare namespace logger {
stream?: stream.Writable | stream.Duplex | stream.Transform;
}
}
declare module 'koa' {
interface Context {
log: Logger;
}
}

View File

@@ -3,3 +3,8 @@ import logger = require('koa-pino-logger');
const app = new koa();
app.use(logger());
app.use((ctx) => {
ctx.log.info('something else');
ctx.body = 'hello world';
});