Muthu Kumar
6 years ago
1 changed files with 14 additions and 0 deletions
@ -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, |
||||
|
}; |
Loading…
Reference in new issue