diff --git a/index.d.ts b/index.d.ts
index cecc834e7..c4a03b847 100644
--- a/index.d.ts
+++ b/index.d.ts
@@ -3,7 +3,7 @@
///
-import * as NodeJSStream from "stream";
+import * as NodeJSStream from 'stream';
import * as logform from 'logform';
import * as Transport from 'winston-transport';
@@ -19,7 +19,8 @@ declare namespace winston {
export import transports = Transports;
export import transport = Transport;
- interface ExceptionHandler {
+ class ExceptionHandler {
+ constructor(logger: Logger);
logger: Logger;
handlers: Map;
catcher: Function | boolean;
@@ -30,11 +31,10 @@ declare namespace winston {
getProcessInfo(): object;
getOsInfo(): object;
getTrace(err: Error): object;
-
- new(logger: Logger): ExceptionHandler;
}
-
- interface RejectionHandler {
+
+ class RejectionHandler {
+ constructor(logger: Logger);
logger: Logger;
handlers: Map;
catcher: Function | boolean;
@@ -45,8 +45,6 @@ declare namespace winston {
getProcessInfo(): object;
getOsInfo(): object;
getTrace(err: Error): object;
-
- new(logger: Logger): RejectionHandler;
}
interface QueryOptions {
@@ -55,17 +53,22 @@ declare namespace winston {
start?: number;
from?: Date;
until?: Date;
- order?: "asc" | "desc";
+ order?: 'asc' | 'desc';
fields: any;
}
- interface Profiler {
+ class Profiler {
logger: Logger;
start: Number;
done(info?: any): boolean;
}
- type LogCallback = (error?: any, level?: string, message?: string, meta?: any) => void;
+ type LogCallback = (
+ error?: any,
+ level?: string,
+ message?: string,
+ meta?: any
+ ) => void;
interface LogEntry {
level: string;
@@ -73,7 +76,7 @@ declare namespace winston {
[optionName: string]: any;
}
- interface LogMethod {
+ interface LogMethod {
(level: string, message: string, callback: LogCallback): Logger;
(level: string, message: string, meta: any, callback: LogCallback): Logger;
(level: string, message: string, ...meta: any[]): Logger;
@@ -103,7 +106,9 @@ declare namespace winston {
rejectionHandlers?: any;
}
- interface Logger extends NodeJSStream.Transform {
+ class Logger extends NodeJSStream.Transform {
+ constructor(options?: LoggerOptions);
+
silent: boolean;
format: logform.Format;
levels: Config.AbstractConfigSetLevels;
@@ -141,7 +146,10 @@ declare namespace winston {
warning: LeveledLogMethod;
notice: LeveledLogMethod;
- query(options?: QueryOptions, callback?: (err: Error, results: any) => void): any;
+ query(
+ options?: QueryOptions,
+ callback?: (err: Error, results: any) => void
+ ): any;
stream(options?: any): NodeJS.ReadableStream;
startTimer(): Profiler;
@@ -158,11 +166,9 @@ declare namespace winston {
isVerboseEnabled(): boolean;
isDebugEnabled(): boolean;
isSillyEnabled(): boolean;
-
- new(options?: LoggerOptions): Logger;
}
- interface Container {
+ class Container {
loggers: Map;
options: LoggerOptions;
@@ -171,13 +177,10 @@ declare namespace winston {
has(id: string): boolean;
close(id?: string): void;
- new(options?: LoggerOptions): Container;
+ constructor(options?: LoggerOptions);
}
let version: string;
- let ExceptionHandler: ExceptionHandler;
- let RejectionHandler: RejectionHandler;
- let Container: Container;
let loggers: Container;
let addColors: (target: Config.AbstractConfigSetColors) => any;
@@ -194,7 +197,10 @@ declare namespace winston {
// Other pass-through methods routed to the default logger.
let log: LogMethod;
- let query: (options?: QueryOptions, callback?: (err: Error, results: any) => void) => any;
+ let query: (
+ options?: QueryOptions,
+ callback?: (err: Error, results: any) => void
+ ) => any;
let stream: (options?: any) => NodeJS.ReadableStream;
let add: (transport: Transport) => Logger;
let remove: (transport: Transport) => Logger;