Set logLevel after loading config

This commit is contained in:
rejas 2020-07-04 22:02:39 +02:00
parent 3282ed4fea
commit 9f5e1b59fb
3 changed files with 14 additions and 7 deletions

View File

@ -202,6 +202,8 @@ var App = function () {
loadConfig(function (c) {
config = c;
Log.setLogLevel(config.logLevel);
var modules = [];
for (var m in config.modules) {

View File

@ -32,13 +32,15 @@
timeStamp: Function.prototype.bind.call(console.timeStamp, console)
};
if (config && config.logLevel) {
Object.keys(logLevel).forEach(function (key, index) {
if (!config.logLevel.includes(key.toLocaleUpperCase())) {
logLevel[key] = function () {};
}
});
}
logLevel.setLogLevel = function (newLevel) {
if (newLevel) {
Object.keys(logLevel).forEach(function (key, index) {
if (!newLevel.includes(key.toLocaleUpperCase())) {
logLevel[key] = function () {};
}
});
}
};
return logLevel;
});

View File

@ -477,6 +477,9 @@ var MM = (function () {
init: function () {
Log.info("Initializing MagicMirror.");
loadConfig();
Log.setLogLevel(config.logLevel);
Translator.loadCoreTranslations(config.language);
Loader.loadModules();
},