Comparing version 0.8.0 to 0.8.1
# Changelog | ||
### 0.8.1 | ||
- Fix: Allow undefined to be passed to setLevel() | ||
### 0.8.0 | ||
@@ -4,0 +8,0 @@ |
@@ -46,5 +46,7 @@ declare const levels: readonly ["trace", "info", "warn", "error", "fatal", "security"]; | ||
/** | ||
* Change the minimum level to write logs | ||
* Change the minimum level to write logs. | ||
* @param newLevelName - If falsy it will just return the current level | ||
* @returns The previous level | ||
*/ | ||
static setLevel(newLevelName: LevelType): LevelType; | ||
static setLevel(newLevelName?: LevelType): LevelType; | ||
/** | ||
@@ -51,0 +53,0 @@ * Parse the Express request (req) object for logging |
@@ -66,6 +66,11 @@ "use strict"; | ||
/** | ||
* Change the minimum level to write logs | ||
* Change the minimum level to write logs. | ||
* @param newLevelName - If falsy it will just return the current level | ||
* @returns The previous level | ||
*/ | ||
static setLevel(newLevelName) { | ||
const previousLevel = Logger.getLevel(); | ||
if (!newLevelName) { | ||
return previousLevel; | ||
} | ||
const newLevelIndex = levels.indexOf(newLevelName); | ||
@@ -72,0 +77,0 @@ if (newLevelIndex >= 0) { |
@@ -137,6 +137,11 @@ import uuid from 'uuid'; | ||
/** | ||
* Change the minimum level to write logs | ||
* Change the minimum level to write logs. | ||
* @param newLevelName - If falsy it will just return the current level | ||
* @returns The previous level | ||
*/ | ||
static setLevel(newLevelName: LevelType): LevelType { | ||
static setLevel(newLevelName?: LevelType): LevelType { | ||
const previousLevel = Logger.getLevel(); | ||
if (!newLevelName) { | ||
return previousLevel; | ||
} | ||
const newLevelIndex = levels.indexOf(newLevelName); | ||
@@ -143,0 +148,0 @@ if (newLevelIndex >= 0) { |
@@ -21,3 +21,3 @@ { | ||
"eslint-plugin-import": "2.18.2", | ||
"eslint-plugin-jest": "23.0.5", | ||
"eslint-plugin-jest": "23.1.0", | ||
"eslint-plugin-security": "1.4.0", | ||
@@ -61,3 +61,3 @@ "jest": "24.9.0", | ||
"types": "dist/index.d.ts", | ||
"version": "0.8.0" | ||
"version": "0.8.1" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
128156
794