Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Typings on LoggerOptions and Logger interfaces. #2021

Merged
merged 3 commits into from
Jan 13, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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