Skip to content

Commit 5b7fdff

Browse files
committed
feat(logs): Refactor logs for asset_copy
1 parent 4ed5ac5 commit 5b7fdff

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

core/lib/asset_copy.js

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
const _ = require('lodash');
33
const path = require('path');
44
const process = require('process');
5+
const logger = require('./log');
56

67
let copy = require('recursive-copy'); // eslint-disable-line prefer-const
78
let chokidar = require('chokidar'); // eslint-disable-line prefer-const
@@ -40,9 +41,7 @@ const asset_copier = () => {
4041
dest,
4142
options
4243
).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}`);
4645
options.emitter.emit('patternlab-asset-change', {
4746
file: p,
4847
dest: dest
@@ -70,9 +69,7 @@ const asset_copier = () => {
7069

7170
//if we want to watch files, do so, otherwise just copy each file
7271
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`);
7673

7774
if (patternlab.watchers[key]) {
7875
patternlab.watchers[key].close();
@@ -130,9 +127,7 @@ const asset_copier = () => {
130127

131128
_.each(globalPaths, (globalPath) => {
132129

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`);
136131

137132
if (patternlab.watchers[globalPath]) {
138133
patternlab.watchers[globalPath].close();
@@ -180,9 +175,8 @@ const asset_copier = () => {
180175
)
181176
);
182177
_.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`);
186180

187181
const patternWatcher = chokidar.watch(
188182
path.resolve(patternWatchPath),

0 commit comments

Comments
 (0)