Add node/browser wrapper around logger

This commit is contained in:
rejas 2020-05-11 07:22:40 +02:00
parent 3b32605b5e
commit 9461c1692a

View File

@ -6,7 +6,15 @@
* By Michael Teeuw https://michaelteeuw.nl * By Michael Teeuw https://michaelteeuw.nl
* MIT Licensed. * MIT Licensed.
*/ */
const Log = (function () { (function (root, factory) {
if (typeof exports === 'object') {
// Node, CommonJS-like
module.exports = factory(root.config);
} else {
// Browser globals (root is window)
root.Log = factory(root.config);
}
}(this, function (config) {
return { return {
info: Function.prototype.bind.call(console.info, console), info: Function.prototype.bind.call(console.info, console),
log: Function.prototype.bind.call(console.log, console), log: Function.prototype.bind.call(console.log, console),
@ -19,4 +27,4 @@ const Log = (function () {
timeEnd: Function.prototype.bind.call(console.timeEnd, console), timeEnd: Function.prototype.bind.call(console.timeEnd, console),
timeStamp: Function.prototype.bind.call(console.timeStamp, console) timeStamp: Function.prototype.bind.call(console.timeStamp, console)
}; };
})(); }));