A simple configurable logger that will indicate when a webpack build has started, succeeded or failed, with colors and emojis!
Example:
const funLogger = require('fun-webpack-logger'),
Chalk = require('chalk'),
ChalkAnimation = require('chalk-animation');
let logger = new funLogger({
holidays: true,
startMessage: "Webpack build started",
successMessage: "Webpack build success",
errorMessage: "Webpack build failed",
startSymbols: ['🙏', '🙏', '🍩'],
successSymbols: ['💯', '🙌', '🎉'],
errorSymbols: ['😱', '😱', '💩'],
animationTimeout: 1000 * 60 * 5,
onStart: [
function (x) {
console.log(Chalk.cyan(x));
}
],
onSuccess: [
function(x) {
let animation = ChalkAnimation.rainbow(x);
setTimeout(() => animation.stop(), this.animationTimeout);
}
],
onError: [
function (x) {
let animation = ChalkAnimation.pulse(x);
setTimeout(() => animation.stop(), this.animationTimeout);
}
],
});
module.exports = {
...
"plugins": [
logger
]
}
This will output the following:
Beginning:
------------------------------------------------------------------
🙏🙏🍩 Webpack build started 🍩🙏🙏
------------------------------------------------------------------
Success:
------------------------------------------------------------------
💯🙌🎉 Webpack build success (47.606s) 🎉🙌💯
Happy National Crunchy Taco Day!
------------------------------------------------------------------
Failure:
------------------------------------------------------------------
😱😱💩 Webpack build failed 💩😱😱
------------------------------------------------------------------