|
2 | 2 | const _ = require('lodash');
|
3 | 3 | const path = require('path');
|
4 | 4 | const process = require('process');
|
| 5 | +const logger = require('./log'); |
5 | 6 |
|
6 | 7 | let copy = require('recursive-copy'); // eslint-disable-line prefer-const
|
7 | 8 | let chokidar = require('chokidar'); // eslint-disable-line prefer-const
|
@@ -40,9 +41,7 @@ const asset_copier = () => {
|
40 | 41 | dest,
|
41 | 42 | options
|
42 | 43 | ).on(copy.events.COPY_FILE_COMPLETE, () => {
|
43 |
| - if (options.debug) { |
44 |
| - console.log(`Moved ${p} to ${dest}`); |
45 |
| - } |
| 44 | + logger.debug(`Moved ${p} to ${dest}`); |
46 | 45 | options.emitter.emit('patternlab-asset-change', {
|
47 | 46 | file: p,
|
48 | 47 | dest: dest
|
@@ -70,9 +69,7 @@ const asset_copier = () => {
|
70 | 69 |
|
71 | 70 | //if we want to watch files, do so, otherwise just copy each file
|
72 | 71 | if (options.watch) {
|
73 |
| - if (patternlab.config.debug) { |
74 |
| - console.log(`Pattern Lab is watching ${path.resolve(basePath, dir.source)} for changes`); |
75 |
| - } |
| 72 | + logger.info(`Pattern Lab is watching ${path.resolve(basePath, dir.source)} for changes`); |
76 | 73 |
|
77 | 74 | if (patternlab.watchers[key]) {
|
78 | 75 | patternlab.watchers[key].close();
|
@@ -130,9 +127,7 @@ const asset_copier = () => {
|
130 | 127 |
|
131 | 128 | _.each(globalPaths, (globalPath) => {
|
132 | 129 |
|
133 |
| - if (patternlab.config.debug) { |
134 |
| - console.log(`Pattern Lab is watching ${globalPath} for changes`); |
135 |
| - } |
| 130 | + logger.info(`Pattern Lab is watching ${globalPath} for changes`); |
136 | 131 |
|
137 | 132 | if (patternlab.watchers[globalPath]) {
|
138 | 133 | patternlab.watchers[globalPath].close();
|
@@ -180,9 +175,8 @@ const asset_copier = () => {
|
180 | 175 | )
|
181 | 176 | );
|
182 | 177 | _.each(patternWatches, (patternWatchPath) => {
|
183 |
| - if (patternlab.config.debug) { |
184 |
| - console.log(`Pattern Lab is watching ${patternWatchPath} for changes`); |
185 |
| - } |
| 178 | + |
| 179 | + logger.info(`Pattern Lab is watching ${patternWatchPath} for changes`); |
186 | 180 |
|
187 | 181 | const patternWatcher = chokidar.watch(
|
188 | 182 | path.resolve(patternWatchPath),
|
|
0 commit comments