Skip to content

Commit

Permalink
Typings on LoggerOptions and Logger interfaces. (#2021)
Browse files Browse the repository at this point in the history
* RejectionHandlers added to LoggerOptions

The 'rejectionHandlers' field was missing on LoggerOptions interface at index.d.ts.
Issue: #1801

* Added handleRejections field to LoggerOptions.

A complement to rejectionHandlers commit.

* Added RejectionHandler to Logger interface

Added RejectionHandler to Logger interface,
Basically the same of PR: #1929
Suggest by: #2021 (comment)
  • Loading branch information
vanflux authored Jan 13, 2022
1 parent a9c7ce1 commit c0afef6
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,21 @@ declare namespace winston {

new(logger: Logger): ExceptionHandler;
}

interface RejectionHandler {
logger: Logger;
handlers: Map<any, any>;
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;
Expand Down Expand Up @@ -83,7 +98,9 @@ declare namespace winston {
defaultMeta?: any;
transports?: Transport[] | Transport;
handleExceptions?: boolean;
handleRejections?: boolean;
exceptionHandlers?: any;
rejectionHandlers?: any;
}

interface Logger extends NodeJSStream.Transform {
Expand All @@ -93,6 +110,7 @@ declare namespace winston {
level: string;
transports: Transport[];
exceptions: ExceptionHandler;
rejections: RejectionHandler;
profilers: object;
exitOnError: Function | boolean;
defaultMeta?: any;
Expand Down Expand Up @@ -158,6 +176,7 @@ declare namespace winston {

let version: string;
let ExceptionHandler: ExceptionHandler;
let RejectionHandler: RejectionHandler;
let Container: Container;
let loggers: Container;

Expand Down Expand Up @@ -186,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;
}
Expand Down

0 comments on commit c0afef6

Please sign in to comment.