Closed basiclines closed 7 years ago
Just to clarify things, i know there is a wintersmith build -q
option to only show critical errors.
What i mean is an implementation that also supports quite mode on custom builds via:
var env = wintersmith(config);
env.build(function(error) {
if (error) throw error;
});
If you construct the environment you can pass your own logger.
var env = new wintersmith.Environment(config, workDir, logger)
Got it working reimplementing those methods:
var logger = {
error: function(error) {
console.log("error", error);
},
warn: function(warn) {
},
verbose: function(verbose) {
},
silly: function(silly) {
}
}
but i had to add "ignore": [],
rule at my config.json
, otherwise i got a JS error:
node_modules/wintersmith/lib/core/content.js:275
if (env.config.ignore.length > 0) {
^
TypeError: Cannot read property 'length' of undefined
at filterIgnored (/Library/WebServer/Documents/comprea/frontend/node_modules/wintersmith/lib/core/content.js:275:28)
at fn (/Library/WebServer/Documents/comprea/frontend/node_modules/wintersmith/node_modules/async/lib/async.js:746:34)
at /Library/WebServer/Documents/comprea/frontend/node_modules/wintersmith/node_modules/async/lib/async.js:1213:16
at /Library/WebServer/Documents/comprea/frontend/node_modules/wintersmith/node_modules/async/lib/async.js:166:37
at /Library/WebServer/Documents/comprea/frontend/node_modules/wintersmith/node_modules/async/lib/async.js:706:43
at /Library/WebServer/Documents/comprea/frontend/node_modules/wintersmith/node_modules/async/lib/async.js:167:37
at Immediate._onImmediate (/Library/WebServer/Documents/comprea/frontend/node_modules/wintersmith/node_modules/async/lib/async.js:1206:34)
at tryOnImmediate (timers.js:543:15)
at processImmediate [as _immediateCallback] (timers.js:523:5)
Having a big project with Wintersmith makes the terminal flooded by the project structure in each build.
https://github.com/jnordberg/wintersmith/blob/master/src/core/renderer.coffee#L40
My suggestion is to make logging optional via
config.js
in this way will be available in the CLI and custom builds.