Skip to content
This repository has been archived by the owner on Apr 26, 2019. It is now read-only.

Commit

Permalink
Edit log messages to be consistent
Browse files Browse the repository at this point in the history
Signed-off-by: Katherine Stanley <katheris@uk.ibm.com>
  • Loading branch information
katheris committed Jan 23, 2018
1 parent dfbd147 commit 5ab7fb2
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 11 deletions.
4 changes: 2 additions & 2 deletions npm/lib/config.js
Expand Up @@ -188,8 +188,8 @@ function Config(defaults) {
}
}
} catch (err) {
logger.writeToLog(`${logId} : Error reading ` + this.configFiles[i] + ' : ' + err);
logger.writeToLog(`${logId} : code : ` + output);
logger.writeToLog(`${logId}:config - Error reading ` + this.configFiles[i] + ' : ' + err);
logger.writeToLog(`${logId}:config - code : ` + output);
throw err;
}
}
Expand Down
4 changes: 2 additions & 2 deletions npm/lib/context.js
Expand Up @@ -55,15 +55,15 @@ function Context(id, config) {
if(!this.paths.length) {
return; //not being written by us
}
this.logger.writeToLog(`${logId} : Destination path`, generator.destinationRoot());
this.logger.writeToLog(`${logId}:writing - Destination path`, generator.destinationRoot());
return this.processor.scan(this.conf, (relativePath, template) => {
let outFile = generator.destinationPath(relativePath);
try {
let compiledTemplate = Handlebars.compile(template);
let output = compiledTemplate(this.conf);
generator.fs.write(outFile, output);
} catch (err) {
this.logger.writeToLog(`${logId} : Template error : ` + relativePath, err.message);
this.logger.writeToLog(`${logId}:writing - Template error : ` + relativePath, err.message);
}
}, this.paths);
}
Expand Down
3 changes: 1 addition & 2 deletions npm/lib/control.js
Expand Up @@ -97,10 +97,9 @@ Control.prototype.processProject = function() {
}
}
} catch (err) {
logger.writeToLog(`${logId} : Control block error : template`, template);
logger.writeToLog(`${logId}:control - Control block error in template`, template);
throw err;
}
logger.writeToLog(`${logId} : Control data`, this.controlBlock);
}

//controls whether or not a file should be included in a generation
Expand Down
10 changes: 5 additions & 5 deletions npm/lib/fsprocessor.js
Expand Up @@ -35,7 +35,7 @@ const dirwalk = function (root, tracker, resolver) {
if (err) {
//TODO : appscan for Java does not like you putting too much info in the error messages, need to check for JS
console.error("There was an error reading the template directory");
logger.writeToLog(`${logId} : Folder error`, err);
logger.writeToLog(`${logId}:fsprocessor - Folder error`, err);
resolver.reject(err);
return;
}
Expand All @@ -53,7 +53,7 @@ const dirwalk = function (root, tracker, resolver) {
//console.log("Found file " + file + " : " + relativePath);
if (err) {
console.error("Error reading file ");
logger.writeToLog(`${logId} : File error`, err);
logger.writeToLog(`${logId}:fsprocessor - File error`, err);
resolver.reject(err);
return;
}
Expand Down Expand Up @@ -141,12 +141,12 @@ const startWalk = function (config, cb, paths) {
const getContentsSync = function (value) {
let file = fspath.resolve(value);
if (!fs.existsSync(file)) {
logger.writeToLog(`${logId} : Error : specified file does not exist`, file);
logger.writeToLog(`${logId}:fsprocessor - Error : specified file does not exist`, file);
throw "Error : specified file does not exist";
}
let stats = fs.statSync(file);
if (stats.isDirectory()) {
logger.writeToLog(`${logId} : Error : specified path is a directory`, file);
logger.writeToLog(`${logId}:fsprocessor - Error : specified path is a directory`, file);
throw "Error : specified path is a directory";
}
try {
Expand All @@ -159,7 +159,7 @@ const getContentsSync = function (value) {
}
} catch (err) {
/* istanbul ignore next */ //file error reading checked in other tests
logger.writeToLog(`${logId} : Error : reading : ` + file, err);
logger.writeToLog(`${logId}:fsprocessor - Error : reading : ` + file, err);
/* istanbul ignore next */
throw err;
}
Expand Down

0 comments on commit 5ab7fb2

Please sign in to comment.