@wdio/logger
Advanced tools
Comparing version 5.6.0 to 5.6.3
@@ -56,2 +56,3 @@ "use strict"; | ||
const loggers = {}; | ||
let logLevelsConfig = {}; | ||
const logCache = new Set(); | ||
@@ -103,3 +104,3 @@ let logFile; | ||
levelFormatter: level => _chalk.default[COLORS[level]](level.toUpperCase()), | ||
nameFormatter: name => _chalk.default.whiteBright(name || 'global') | ||
nameFormatter: name => _chalk.default.whiteBright(name) | ||
}); | ||
@@ -115,7 +116,28 @@ | ||
let logLevel = process.env.WDIO_LOG_LEVEL || DEFAULT_LEVEL; | ||
const logLevelName = getLogLevelName(name); | ||
if (logLevelsConfig[logLevelName]) { | ||
logLevel = logLevelsConfig[logLevelName]; | ||
} | ||
loggers[name] = _loglevel.default.getLogger(name); | ||
loggers[name].setLevel(process.env.WDIO_LOG_LEVEL || DEFAULT_LEVEL); | ||
loggers[name].setLevel(logLevel); | ||
return loggers[name]; | ||
} | ||
getLogger.setLevel = (name, level) => loggers[name].setLevel(level); | ||
getLogger.setLevel = (name, level) => loggers[name].setLevel(level); | ||
getLogger.setLogLevelsConfig = (logLevels = {}) => { | ||
logLevelsConfig = {}; | ||
Object.keys(logLevels).forEach(loggerName => { | ||
const logLevelName = getLogLevelName(loggerName); | ||
logLevelsConfig[logLevelName] = logLevels[loggerName]; | ||
if (loggers[loggerName]) { | ||
loggers[loggerName].setLevel(logLevelsConfig[logLevelName]); | ||
} | ||
}); | ||
}; | ||
const getLogLevelName = logName => logName.split(':').shift(); |
@@ -23,2 +23,4 @@ "use strict"; | ||
getLogger.setLevel = () => {}; | ||
getLogger.setLevel = () => {}; | ||
getLogger.setLogLevelsConfig = () => {}; |
{ | ||
"name": "@wdio/logger", | ||
"version": "5.6.0", | ||
"version": "5.6.3", | ||
"description": "A helper utility for logging of WebdriverIO packages", | ||
@@ -41,3 +41,3 @@ "author": "Christian Bromann <christian@saucelabs.com>", | ||
}, | ||
"gitHead": "00bdd480d34757277d8b9f4f62f504311671a82e" | ||
"gitHead": "63ac0243ab13faf562b5e539ef84e727543dead1" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
7155
154