mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-06-28 12:12:20 +00:00
Add node/browser wrapper around logger
This commit is contained in:
parent
3b32605b5e
commit
9461c1692a
12
js/logger.js
12
js/logger.js
@ -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)
|
||||||
};
|
};
|
||||||
})();
|
}));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user