mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-06-27 19:53:36 +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
|
||||
* 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 {
|
||||
info: Function.prototype.bind.call(console.info, console),
|
||||
log: Function.prototype.bind.call(console.log, console),
|
||||
@ -19,4 +27,4 @@ const Log = (function () {
|
||||
timeEnd: Function.prototype.bind.call(console.timeEnd, console),
|
||||
timeStamp: Function.prototype.bind.call(console.timeStamp, console)
|
||||
};
|
||||
})();
|
||||
}));
|
||||
|
Loading…
x
Reference in New Issue
Block a user