Debug option at plugins
See original GitHub issueJust an idea:
Currently the plugins have 4 lines of console log each if everything goes without any errors:
[SearchIndex] Compiling file public/wp-search.json
[SearchIndex] Successfully fetched posts from http://xxxxxxxxx/graphql
[SearchIndex] Created directory ./public
[SearchIndex] Successfully wrote file to public/wp-search.json
Making a total of 12 lines if all plugins are passed. I was thinking that maybe is a good idea to just log 1 line (per plugin) if everthing goes as supossed, something like: Successfully created: wp-search.json
.
In order to not lose all the useful console logs, we can grab a new boolean variable debug at each plugin:
const { env, outputDirectory, outputName, debug = false } = nextConfig;
And set all console logs with an && operator based on that debug variable.
debug && console.log('....')
Like so, by default only one line is logged (a new final log added after plugin.postcreate, not conditional). The errors will still work as they are handle as throw new Error
. Also in case is needed, we can pass the variable debug = true at next.config.js
and activate all the logs accross the code.
What do you think?
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (3 by maintainers)
Top GitHub Comments
yup sounds great, thanks
Exactly. I can take care of this one if you like the idea