From 0c888ffd2a7f7caa64232a82e3cd531c07745588 Mon Sep 17 00:00:00 2001 From: Zimmee Date: Tue, 10 Apr 2018 17:28:11 -0600 Subject: [PATCH] fix(logging): Better `logging` for watcher. [BRANCH: master] --- lib/stakcss.js | 17 ++++++++++++----- package.json | 2 +- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/lib/stakcss.js b/lib/stakcss.js index dd89095..7aefee9 100644 --- a/lib/stakcss.js +++ b/lib/stakcss.js @@ -257,7 +257,7 @@ function processResults(results, config = {}) { // Return the result object. timer.stop('profile-' + config.id); if (!config.hasWatcher && config.profiles && config.profiles.length > 1) { - log.warn(`Completed profile \`${config.id}\` (${timer.duration('profile-' + config.id)}).`); + log.warn(`Completed \`${config.id}\` (${timer.duration('profile-' + config.id)}).`); } timer.clear('profile-' + config.id); return result; @@ -278,15 +278,22 @@ function createWatcher(config = {}) { alwaysStat: true }); watcher - .on('change', () => { + .on('change', (filepath) => { + timer.start('watcher-' + config.id); config.content = ''; - log.warn(`Running profile \`${config.id}\`...`); - return runProfile(config); + log.warn(`Changed: ${filepath}`); + log.warn(`Running [${config.id}]...`); + return runProfile(config).then(() => { + timer.stop('watcher-' + config.id); + log.warn(`[${config.id}] Done (${timer.duration('watcher-' + config.id)}).`); + timer.clear('watcher-' + config.id); + return config; + }); }) .on('error', (error) => logError(error, config)) .on('ready', () => { config.hasWatcher = true; - log.error(`Watching profile \`${config.id}\`...`); + log.error(`Watching [${config.id}]...`); return config.watcher; }); diff --git a/package.json b/package.json index f69d4ae..7b8d117 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@brikcss/stakcss", - "version": "0.7.0", + "version": "0.7.1", "description": "Stakcss takes a \"stak\" of files or data, runs them through a series of bundlers (not included), and outputs bundled data, optionally saved to disk.", "author": "BrikCSS ", "contributors": [