Skip to content

Commit

Permalink
fix(types): Added return type for configure(...).
Browse files Browse the repository at this point in the history
  • Loading branch information
Ilja Denisovs committed Feb 15, 2018
1 parent 5d276a4 commit fe07ab2
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
13 changes: 11 additions & 2 deletions types/log4js.d.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
// Type definitions for log4js

export interface Log4js {
getLogger,
configure,
addLayout,
connectLogger,
levels,
shutdown
}

export function getLogger(category?: string): Logger;

export function configure(filename: string): void;
export function configure(config: Configuration): void;
export function configure(filename: string): Log4js;
export function configure(config: Configuration): Log4js;

export function addLayout(name: string, config: (a: any) => (logEvent: LoggingEvent) => string): void;

Expand Down
5 changes: 5 additions & 0 deletions types/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,3 +108,8 @@ configure({
appenders: { cheese: { type: 'file', filename: 'cheese.log' } },
categories: { default: { appenders: ['cheese'], level: 'error' } }
});

log4js.configure('./filename').getLogger();
const logger7 = log4js.getLogger();
logger7.level = 'debug';
logger7.debug("Some debug messages");

0 comments on commit fe07ab2

Please sign in to comment.