diff --git a/src/lib/logger.js b/src/lib/logger.js new file mode 100644 index 0000000..599981d --- /dev/null +++ b/src/lib/logger.js @@ -0,0 +1,14 @@ +/** + * Creates a Logger that only logs if 'log' option was true + * @param {Object} options + * @param {boolean=} options.log + */ +const logger = options => { + const log = (...strings) => options.log && console.log(...strings); + log.true = options.log; + return log; +}; + +module.exports = { + create: logger, +};