Skip to content

Commit

Permalink
Merge pull request #31 from ErikSchierboom/getlevel
Browse files Browse the repository at this point in the history
feat(logging): Allow global logLevel to be returned
  • Loading branch information
EisenbergEffect authored Nov 10, 2016
2 parents 4c1c91c + 1c61077 commit 21d92e7
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand Down
7 changes: 7 additions & 0 deletions test/logging.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down

0 comments on commit 21d92e7

Please sign in to comment.