From c9c2f52071e70b721082510386731999ca69fd4a Mon Sep 17 00:00:00 2001 From: Lucas Abruzzi Date: Tue, 11 Jan 2022 19:31:50 -0300 Subject: [PATCH 1/3] RejectionHandlers added to LoggerOptions The 'rejectionHandlers' field was missing on LoggerOptions interface at index.d.ts. Issue: https://github.com/winstonjs/winston/issues/1801 --- index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/index.d.ts b/index.d.ts index 027379c39..697fd7aac 100644 --- a/index.d.ts +++ b/index.d.ts @@ -84,6 +84,7 @@ declare namespace winston { transports?: Transport[] | Transport; handleExceptions?: boolean; exceptionHandlers?: any; + rejectionHandlers?: any; } interface Logger extends NodeJSStream.Transform { From e440592fe601046fb4b4c054d8b88368c31426e5 Mon Sep 17 00:00:00 2001 From: Lucas Abruzzi Date: Tue, 11 Jan 2022 19:40:04 -0300 Subject: [PATCH 2/3] Added handleRejections field to LoggerOptions. A complement to rejectionHandlers commit. --- index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/index.d.ts b/index.d.ts index 697fd7aac..7dc26d186 100644 --- a/index.d.ts +++ b/index.d.ts @@ -83,6 +83,7 @@ declare namespace winston { defaultMeta?: any; transports?: Transport[] | Transport; handleExceptions?: boolean; + handleRejections?: boolean; exceptionHandlers?: any; rejectionHandlers?: any; } From 2d73619d495006ae881f18689d070dc14c34543c Mon Sep 17 00:00:00 2001 From: Lucas Abruzzi Date: Thu, 13 Jan 2022 11:14:19 -0300 Subject: [PATCH 3/3] Added RejectionHandler to Logger interface Added RejectionHandler to Logger interface, Basically the same of PR: https://github.com/winstonjs/winston/pull/1929 Suggest by: https://github.com/winstonjs/winston/pull/2021#issuecomment-1011697784 --- index.d.ts | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/index.d.ts b/index.d.ts index 7dc26d186..cecc834e7 100644 --- a/index.d.ts +++ b/index.d.ts @@ -33,6 +33,21 @@ declare namespace winston { new(logger: Logger): ExceptionHandler; } + + interface RejectionHandler { + logger: Logger; + handlers: Map; + catcher: Function | boolean; + + handle(...transports: Transport[]): void; + unhandle(...transports: Transport[]): void; + getAllInfo(err: string | Error): object; + getProcessInfo(): object; + getOsInfo(): object; + getTrace(err: Error): object; + + new(logger: Logger): RejectionHandler; + } interface QueryOptions { rows?: number; @@ -95,6 +110,7 @@ declare namespace winston { level: string; transports: Transport[]; exceptions: ExceptionHandler; + rejections: RejectionHandler; profilers: object; exitOnError: Function | boolean; defaultMeta?: any; @@ -160,6 +176,7 @@ declare namespace winston { let version: string; let ExceptionHandler: ExceptionHandler; + let RejectionHandler: RejectionHandler; let Container: Container; let loggers: Container; @@ -188,6 +205,7 @@ declare namespace winston { let child: (options: Object) => Logger; let level: string; let exceptions: ExceptionHandler; + let rejections: RejectionHandler; let exitOnError: Function | boolean; // let default: object; }