From 08ac27e80a1818258be0d8a8d146f0fdacc3dc20 Mon Sep 17 00:00:00 2001 From: Muthu Kumar Date: Fri, 24 Aug 2018 12:20:50 +0530 Subject: [PATCH] [logger] Added logger --- src/lib/logger.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 src/lib/logger.js 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, +};