mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-08-21 12:55:22 +00:00
More console -> Logger conversions
This commit is contained in:
@@ -17,7 +17,7 @@ const fs = require("fs");
|
||||
|
||||
const rootPath = path.resolve(__dirname + "/../");
|
||||
const config = require(rootPath + "/.eslintrc.json");
|
||||
const Logger = require(rootPath + "/js/logger.js");
|
||||
const Log = require(rootPath + "/js/logger.js");
|
||||
const Utils = require(rootPath + "/js/utils.js");
|
||||
|
||||
/* getConfigFile()
|
||||
@@ -37,19 +37,19 @@ function checkConfigFile() {
|
||||
const configFileName = getConfigFile();
|
||||
// Check if file is present
|
||||
if (fs.existsSync(configFileName) === false) {
|
||||
Logger.error(Utils.colors.error("File not found: "), configFileName);
|
||||
Log.error(Utils.colors.error("File not found: "), configFileName);
|
||||
return;
|
||||
}
|
||||
// check permission
|
||||
try {
|
||||
fs.accessSync(configFileName, fs.F_OK);
|
||||
} catch (e) {
|
||||
Logger.log(Utils.colors.error(e));
|
||||
Log.log(Utils.colors.error(e));
|
||||
return;
|
||||
}
|
||||
|
||||
// Validate syntax of the configuration file.
|
||||
Logger.info(Utils.colors.info("Checking file... "), configFileName);
|
||||
Log.info(Utils.colors.info("Checking file... "), configFileName);
|
||||
|
||||
// I'm not sure if all ever is utf-8
|
||||
fs.readFile(configFileName, "utf-8", function (err, data) {
|
||||
@@ -58,12 +58,12 @@ function checkConfigFile() {
|
||||
}
|
||||
const messages = linter.verify(data, config);
|
||||
if (messages.length === 0) {
|
||||
Logger.log("Your configuration file doesn't contain syntax errors :)");
|
||||
Log.log("Your configuration file doesn't contain syntax errors :)");
|
||||
return true;
|
||||
} else {
|
||||
// In case the there errors show messages and return
|
||||
messages.forEach((error) => {
|
||||
Logger.log("Line", error.line, "col", error.column, error.message);
|
||||
Log.log("Line", error.line, "col", error.column, error.message);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
Reference in New Issue
Block a user