mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-07-01 07:40:10 +00:00
[koa-pino-logger] add context variable used for manual logging (#29506)
This commit is contained in:
6
types/koa-pino-logger/index.d.ts
vendored
6
types/koa-pino-logger/index.d.ts
vendored
@@ -26,3 +26,9 @@ declare namespace logger {
|
||||
stream?: stream.Writable | stream.Duplex | stream.Transform;
|
||||
}
|
||||
}
|
||||
|
||||
declare module 'koa' {
|
||||
interface Context {
|
||||
log: Logger;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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';
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user