Skip to content

Commit

Permalink
Merge pull request #202 from bryan-m-hughes/timob-13987
Browse files Browse the repository at this point in the history
[TIMOB-13987] Reworked the order in which the alloy hook is validated
  • Loading branch information
pinnamur committed May 24, 2013
2 parents 7dd319e + 7ed019b commit 6b6530a
Showing 1 changed file with 28 additions and 28 deletions.
56 changes: 28 additions & 28 deletions commands/analyze.js
Original file line number Diff line number Diff line change
Expand Up @@ -214,36 +214,36 @@ function runFromConfigFile(logger, config, cli) {
process.exit(1);
}

// Validate the Alloy hook
validateAlloyHook(configFile.sourceInformation.projectDir, logger, function () {

// Validate the logging and finagle things around for outputs other than report
if (configFile.logging && configFile.logging.file) {
if (['trace', 'debug', 'info', 'notice', 'warn', 'error'].indexOf(configFile.logging.file.level) === -1) {
console.error(__('Unknown log level "%s"', configFile.logging.file.level));
process.exit(1);
}
filename = configFile.logging.file.path;
if (!existsSync(path.dirname(filename))) {
wrench.mkdirSyncRecursive(path.dirname(filename));
}
logger.add(winston.transports.File, {
filename: path.resolve(filename),
level: configFile.logging.file.level
});
// Validate the logging and finagle things around for outputs other than report
if (configFile.logging && configFile.logging.file) {
if (['trace', 'debug', 'info', 'notice', 'warn', 'error'].indexOf(configFile.logging.file.level) === -1) {
console.error(__('Unknown log level "%s"', configFile.logging.file.level));
process.exit(1);
}
if (argv.output !== 'report') {
logger.remove(winston.transports.Console);
if (configFile.logging.console) {
logger.warn(__('Console logging settings will be ignored because the output type is not report'));
}
} else if (configFile.logging.console) {
if (['trace', 'debug', 'info', 'notice', 'warn', 'error'].indexOf(configFile.logging.console.level) === -1) {
console.error(__('Unknown log level "%s"', configFile.logging.console.level));
process.exit(1);
}
logger.setLevel(configFile.logging.console.level);
filename = configFile.logging.file.path;
if (!existsSync(path.dirname(filename))) {
wrench.mkdirSyncRecursive(path.dirname(filename));
}
logger.add(winston.transports.File, {
filename: path.resolve(filename),
level: configFile.logging.file.level
});
}
if (argv.output !== 'report') {
logger.remove(winston.transports.Console);
if (configFile.logging.console) {
logger.warn(__('Console logging settings will be ignored because the output type is not report'));
}
} else if (configFile.logging.console) {
if (['trace', 'debug', 'info', 'notice', 'warn', 'error'].indexOf(configFile.logging.console.level) === -1) {
console.error(__('Unknown log level "%s"', configFile.logging.console.level));
process.exit(1);
}
logger.setLevel(configFile.logging.console.level);
}

// Validate the Alloy hook
validateAlloyHook(configFile.sourceInformation.projectDir, logger, function () {

if (!configFile.options) {
configFile.options = {};
Expand Down

0 comments on commit 6b6530a

Please sign in to comment.