Read the statement by Michael Teeuw here.
console.Log() shows nothing?
-
@mortenbirkelund the module doesnt log in the terminal only the node_helper does. The module logs into electron or your browser start the mirror wih
npm start dev
-
@mortenbirkelund these console.log() statements are not crated in the node application, but in the browser. Open the mirror in a main stream browser (IE or chrome or something) and hit F12 which will bring up the dev tools look in the console there for your message.
-
@strawberry-3.141
Just to add, because I found this irritating at first:
If your browser does not open the console in dev mode then press F12 (works in every common browser) and look at the error/warning/log output thereAh, @izanbard was faster :-)
-
@strawberry-3.141 said in console.Log() shows nothing?:
npm start dev
Thank you very much, both of you. Now I can see the logs.
-
@mortenbirkelund just a note if you put a console.log() in the node_helper, then it apears on the command line output (or PM2 out.log if you are using PM2)
-
Thank you once again for your help. Now that I understand where to see the logs, i can see that my button is not working. Anybody who knows why nothing happens when I click the button
Module.register("MMM-Slider",{ // Default module config. defaults: { //text: "Hello World!" }, // Override dom generator. getDom: function() { var wrapper = document.createElement("div"); wrapper.appendChild(this.createButton()); return wrapper; }, createButton: function() { var button = document.createElement("span"); button.innerHTML ="Click me"; button.id = this.identifier + "_button"; button.addEventListener("click", function () { console.log("The button was clicked"); }); return button; } });
-
@Snille I have looked at your button module for inspiration. Do you know why nothing happens when I click the button?
-
Found the error. I needed to add
.region.fullscreen {
z-index: -1;
}as css and now it is working.
-
Hmm… I don’t have any custom css om my develop-version of MM, but the problem is of course that you will not see the pointer when moving over to the “mirror” if you are using a mouse.
You can add a custom.css with only:body { cursor: pointer; }
then you will see where you “are” when moving the mouse. :)
But you should not need anything else. -
@mortenbirkelund I know this is really 4 years old, but it was my first match on Google. I couldn’t figure out why logs weren’t printing to terminal.
Anyhow, to make Electron print to terminal, add this to the environment variables:
ELECTRON_ENABLE_LOGGING=1
Hope it helps others!