2.1.7 • Published 6 months ago
@types/koa-bunyan-logger v2.1.7
Installation
npm install --save @types/koa-bunyan-logger
Summary
This package contains type definitions for koa-bunyan-logger (https://github.com/koajs/bunyan-logger).
Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/koa-bunyan-logger.
index.d.ts
// Type definitions for koa-bunyan-logger 2.1
// Project: https://github.com/koajs/bunyan-logger
// Definitions by: Steven McDowall <https://github.com/sjmcdowall>
// Jan Karlo Dela Cruz <https://github.com/jankdc>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
import { Middleware, Request, Response } from 'koa';
import Logger = require('bunyan');
declare function koaBunyanLogger(logger?: Logger): Middleware;
declare namespace koaBunyanLogger {
interface RequestData {
req: Request;
}
interface ResponseData {
req: Request;
res: Response;
}
interface RequestIdContextOptions {
header?: string | undefined;
prop?: string | undefined;
requestProp?: string | undefined;
field?: string | undefined;
}
interface RequestLoggerOptions {
durationField?: string | undefined;
levelFn?: ((status: number, err: Error) => string) | undefined;
updateLogFields?: ((data: RequestData) => RequestData) | undefined;
updateRequestLogFields?: ((requestData: RequestData) => RequestData) | undefined;
updateResponseLogFields?: ((responseData: ResponseData) => ResponseData) | undefined;
formatRequestMessage?: ((requestData: RequestData) => string) | undefined;
formatResponseMessage?: ((responseData: ResponseData) => string) | undefined;
ignorePath?: string[] | undefined;
}
interface TimeContextOptions {
logLevel?: string | undefined;
updateLogFields?: ((fields: any) => any) | undefined;
}
function requestLogger(opts?: RequestLoggerOptions): Middleware;
function requestIdContext(opts?: RequestIdContextOptions): Middleware;
function timeContext(opts?: TimeContextOptions): Middleware;
}
// Extend the Koa context to add the logger..
declare module 'koa' {
interface BaseContext {
log: Logger;
}
}
export = koaBunyanLogger;
Additional Details
- Last updated: Thu, 08 Jul 2021 16:23:19 GMT
- Dependencies: @types/koa, @types/bunyan
- Global values: none
Credits
These definitions were written by Steven McDowall, and Jan Karlo Dela Cruz.