Skip to content

Commit

Permalink
fix(logging): Better logging for watcher.
Browse files Browse the repository at this point in the history
[BRANCH: master]
  • Loading branch information
thezimmee committed Apr 10, 2018
1 parent b82b6e3 commit 0c888ff
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
17 changes: 12 additions & 5 deletions lib/stakcss.js
Expand Up @@ -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;
Expand All @@ -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;
});

Expand Down
2 changes: 1 addition & 1 deletion 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 <https://github.com/brikcss>",
"contributors": [
Expand Down

0 comments on commit 0c888ff

Please sign in to comment.