Skip to content

Commit

Permalink
Add typings for the isLevelEnabled(string) and isXXXEnabled() functio…
Browse files Browse the repository at this point in the history
…ns (#1622)
  • Loading branch information
Kishan Gajera authored and DABH committed Mar 24, 2019
1 parent 8f4cddc commit 1a75544
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
10 changes: 9 additions & 1 deletion index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,17 @@ declare namespace winston {
profile(id: string | number, meta?: LogEntry): Logger;

configure(options: LoggerOptions): void;

child(options: Object): Logger;

isLevelEnabled(level: string): boolean;
isErrorEnabled(): boolean;
isWarnEnabled(): boolean;
isInfoEnabled(): boolean;
isVerboseEnabled(): boolean;
isDebugEnabled(): boolean;
isSillyEnabled(): boolean;

new(options?: LoggerOptions): Logger;
}

Expand Down
8 changes: 8 additions & 0 deletions test/typescript-definitions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,11 @@ const level = container.options.level;

container = new winston.Container();
logger = container.get('testLogger2');

logger.isLevelEnabled('debug');
logger.isErrorEnabled();
logger.isWarnEnabled();
logger.isInfoEnabled();
logger.isVerboseEnabled();
logger.isDebugEnabled();
logger.isSillyEnabled();

0 comments on commit 1a75544

Please sign in to comment.