Skip to content

Commit 5442a84

Browse files
committed
feat(logs): Refactor logs for pseudopattern_hunter
1 parent 884975c commit 5442a84

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

core/lib/pseudopattern_hunter.js

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ const _ = require('lodash');
77
const lh = require('./lineage_hunter');
88
const Pattern = require('./object_factory').Pattern;
99
const path = require('path');
10+
const logger = require('./log');
1011
const lineage_hunter = new lh();
1112
const changes_hunter = new ch();
1213

@@ -29,17 +30,15 @@ pseudopattern_hunter.prototype.find_pseudopatterns = function (currentPattern, p
2930

3031
if (pseudoPatterns.length > 0) {
3132
for (let i = 0; i < pseudoPatterns.length; i++) {
32-
if (patternlab.config.debug) {
33-
console.log('found pseudoPattern variant of ' + currentPattern.patternPartial);
34-
}
33+
logger.debug(`Found pseudoPattern variant of ${currentPattern.patternPartial}`);
3534

3635
//we want to do everything we normally would here, except instead read the pseudoPattern data
3736
try {
3837
var variantFileFullPath = path.resolve(paths.source.patterns, pseudoPatterns[i]);
3938
var variantFileData = fs.readJSONSync(variantFileFullPath);
4039
} catch (err) {
41-
console.log('There was an error parsing pseudopattern JSON for ' + currentPattern.relPath);
42-
console.log(err);
40+
logger.warning(`There was an error parsing pseudopattern JSON for ${currentPattern.relPath}`);
41+
logger.warning(err);
4342
}
4443

4544
//extend any existing data with variant data
@@ -84,8 +83,8 @@ pseudopattern_hunter.prototype.find_pseudopatterns = function (currentPattern, p
8483
var variantFileFullPath = path.resolve(paths.source.patterns, pseudoPatterns[i]);
8584
var variantFileData = fs.readJSONSync(variantFileFullPath);
8685
} catch (err) {
87-
console.log('There was an error parsing pseudopattern JSON for ' + currentPattern.relPath);
88-
console.log(err);
86+
logger.warning(`There was an error parsing pseudopattern JSON for ${currentPattern.relPath}`);
87+
logger.warning(err);
8988
}
9089

9190
//extend any existing data with variant data

0 commit comments

Comments
 (0)