From 15ad62197f13799f4df7bfa1cd1523e57719e271 Mon Sep 17 00:00:00 2001 From: TeamworkGuy2 Date: Thu, 2 Jun 2016 15:09:53 +0000 Subject: [PATCH] tweak log4javascript.Level, change from enum to class with static fields to match implementation. (#9498) --- log4javascript/log4javascript-tests.ts | 9 ++++++++- log4javascript/log4javascript.d.ts | 17 ++++++++++++++++- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/log4javascript/log4javascript-tests.ts b/log4javascript/log4javascript-tests.ts index c3b77c5b69..b05626b297 100644 --- a/log4javascript/log4javascript-tests.ts +++ b/log4javascript/log4javascript-tests.ts @@ -2,7 +2,14 @@ function aSimpleLoggingMessageString() { var log = log4javascript.getDefaultLogger(); - log.info("Hello World"); + log.info("Hello World"); +} + +function compareLogLevelsAndLog() { + var log = log4javascript.getDefaultLogger(); + if (log4javascript.Level.INFO.isGreaterOrEqual(log.getLevel())) { + log.log(log4javascript.Level.INFO, ["Info"]); + } } function loggingAnErrorWithAMessage() { diff --git a/log4javascript/log4javascript.d.ts b/log4javascript/log4javascript.d.ts index d22e666e8f..55d7726563 100644 --- a/log4javascript/log4javascript.d.ts +++ b/log4javascript/log4javascript.d.ts @@ -89,7 +89,22 @@ declare namespace log4javascript { /** * Levels are available as static properties of the log4javascript.Level object. */ - export enum Level { ALL, TRACE, DEBUG, INFO, WARN, ERROR, FATAL, OFF } + export class Level { + static ALL: Level; + static TRACE: Level; + static DEBUG: Level; + static INFO: Level; + static WARN: Level; + static ERROR: Level; + static FATAL: Level; + static OFF: Level; + + constructor(level: number, name: string); + + toString(): string; + equals(level: Level): boolean; + isGreaterOrEqual(level: Level): boolean; + } // #endregion