@@ -7,6 +7,7 @@ const list_item_hunter = function () {
7
7
const smh = require ( './style_modifier_hunter' ) ;
8
8
const jsonCopy = require ( './json_copy' ) ;
9
9
const Pattern = require ( './object_factory' ) . Pattern ;
10
+ const logger = require ( './log' ) ;
10
11
11
12
const pattern_assembler = new pa ( ) ;
12
13
const style_modifier_hunter = new smh ( ) ;
@@ -19,9 +20,7 @@ const list_item_hunter = function () {
19
20
if ( matches !== null ) {
20
21
matches . forEach ( function ( liMatch ) {
21
22
22
- if ( patternlab . config . debug ) {
23
- console . log ( 'found listItem of size ' + liMatch + ' inside ' + pattern . patternPartial ) ;
24
- }
23
+ logger . debug ( `found listItem of size ${ liMatch } inside ${ pattern . patternPartial } ` ) ;
25
24
26
25
//find the boundaries of the block
27
26
const loopNumberString = liMatch . split ( '.' ) [ 1 ] . split ( '}' ) [ 0 ] . trim ( ) ;
@@ -32,9 +31,8 @@ const list_item_hunter = function () {
32
31
const repeatedBlockTemplate = [ ] ;
33
32
let repeatedBlockHtml = '' ;
34
33
for ( let i = 0 ; i < items . indexOf ( loopNumberString ) ; i ++ ) {
35
- if ( patternlab . config . debug ) {
36
- console . log ( 'list item(s) in pattern' , pattern . patternPartial , 'adding' , patternBlock , 'to repeatedBlockTemplate' ) ;
37
- }
34
+
35
+ logger . debug ( `list item(s) in pattern ${ pattern . patternPartial } , adding ${ patternBlock } to repeatedBlockTemplate` ) ;
38
36
repeatedBlockTemplate . push ( patternBlock ) ;
39
37
}
40
38
@@ -43,8 +41,8 @@ const list_item_hunter = function () {
43
41
try {
44
42
listData = jsonCopy ( patternlab . listitems , 'config.paths.source.data listitems' ) ;
45
43
} catch ( err ) {
46
- console . log ( ' There was an error parsing JSON for ' + pattern . relPath ) ;
47
- console . log ( err ) ;
44
+ logger . warning ( ` There was an error parsing JSON for ${ pattern . relPath } ` ) ;
45
+ logger . warning ( err ) ;
48
46
}
49
47
50
48
listData = _ . merge ( listData , pattern . listitems ) ;
@@ -64,8 +62,8 @@ const list_item_hunter = function () {
64
62
globalData = jsonCopy ( patternlab . data , 'config.paths.source.data global data' ) ;
65
63
localData = jsonCopy ( pattern . jsonFileData , `${ pattern . patternPartial } data` ) ;
66
64
} catch ( err ) {
67
- console . log ( ' There was an error parsing JSON for ' + pattern . relPath ) ;
68
- console . log ( err ) ;
65
+ logger . warning ( ` There was an error parsing JSON for ${ pattern . relPath } ` ) ;
66
+ logger . warning ( err ) ;
69
67
}
70
68
71
69
let allData = _ . merge ( globalData , localData ) ;
@@ -89,8 +87,8 @@ const list_item_hunter = function () {
89
87
cleanPartialPattern = JSON . parse ( JSON . stringify ( partialPattern ) ) ;
90
88
cleanPartialPattern = jsonCopy ( partialPattern , `partial pattern ${ partialName } ` ) ;
91
89
} catch ( err ) {
92
- console . log ( ' There was an error parsing JSON for ' + pattern . relPath ) ;
93
- console . log ( err ) ;
90
+ logger . warning ( ` There was an error parsing JSON for ${ pattern . relPath } ` ) ;
91
+ logger . warning ( err ) ;
94
92
}
95
93
96
94
//if we retrieved a pattern we should make sure that its extendedTemplate is reset. looks to fix #356
0 commit comments