diff --git a/src/index.js b/src/index.js index 10d0bac..525daf1 100644 --- a/src/index.js +++ b/src/index.js @@ -178,6 +178,15 @@ export function setLevel(level: number): void { } } +/** +* Gets the level of logging of ALL the application loggers. +* +* @return The logLevel value used in all loggers. +*/ +export function getLevel(): number { + return globalDefaultLevel; +} + /** * A logger logs messages to a set of appenders, depending on the log level that is set. */ diff --git a/test/logging.spec.js b/test/logging.spec.js index c1d4eeb..7b336c4 100644 --- a/test/logging.spec.js +++ b/test/logging.spec.js @@ -135,6 +135,13 @@ describe('The log manager ', () => { expect(attemptingToNewUpALogger).toThrow(); }); + it('should be able to return the global logLevel', () => { + LogManager.setLevel(LogManager.logLevel.debug); + var globalLogLevel = LogManager.getLevel(); + + expect(globalLogLevel).toEqual( LogManager.logLevel.debug); + }); + describe('setting logLevel per individual logger instance', () => { it('should not log if specific logger logLevel is none', () => {