A New Chapter for MagicMirror: The Community Takes the Lead
Read the statement by Michael Teeuw here.
Read the statement by Michael Teeuw here.
Consolidate logging to browser console
-
I wanted to share a simple approach to unify logging across module components that I found incredibly useful during development. This will put all* logging in a browser console and remove the need to monitor pm2/pi console logs.
In your main module code (MMM-ABC.js), where you define your sockets simply add:
if (notification === 'HELPER_MESSAGE') { if (this.config.debug === 1) { Log.info(payload); } //Receive a message, log the payload to the browser console. }
In your node_helper.js module, construct and send messages:
if (self.config.debug === 1) { apiMessage = moment().format('YYYY-MM-DD>>HH:mm:ss.SSSZZ') + ' [node_helper] << your log message content here >>'; self.sendSocketNotification('HELPER_MESSAGE', apiMessage); }
Hope this helps on your development journey!
*any code errors / exceptions will still throw to the raspberry pi console / pm2