• Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
MagicMirror Forum
  • Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
A New Chapter for MagicMirror: The Community Takes the Lead
Read the statement by Michael Teeuw here.

console.Log() shows nothing?

Scheduled Pinned Locked Moved Solved Development
19 Posts 8 Posters 15.0k Views 7 Watching
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    mortenbirkelund
    last edited by Feb 21, 2017, 9:31 PM

    @strawberry-3.141 said in console.Log() shows nothing?:

    console.log(“Debug Message”);

    Thanks for your reply. The “Log” in the title was a mistake.
    the console.log(); doesnth work either.

    
    
    Module.register("MMM-Slider",{
    
    	// Default module config.
    	defaults: {
    		//text: "Hello World!"
    
    	},
    
    	// Override dom generator.
    	getDom: function() {
    		console.log("Test");
    		var wrapper = document.createElement("div");
    		
    		wrapper.appendChild(createButton());
    		return wrapper;
    	},
    	
    	start: function() {
    		console.log("Debug Message");
    
    	},
    	
    	createButton: function() {
    		//Create the button
    		var button = document.createElement("button");
    		button.innerHTML ="Click me";
    
    		button.addEventListener("click", function() {
      			console.log("Visiting show URL");
    		});
    
    		return button;
    	}
    	
    });
    

    The above code was my simple attempt to create a button. The button is created, but nothing happens when i click it, and nothing is shown when MagicMirror is started.

    Starting MagicMirror: v2.1.0
    Loading config ...
    Loading module helpers ...
    No helper found for module: alert.
    No helper found for module: MMM-ProfileSwitcher.
    Initializing new module helper ...
    No helper found for module: clock.
    No helper found for module: MMM-Slider.
    Initializing new module helper ...
    No helper found for module: compliments.
    No helper found for module: weatherforecast.
    All module helpers loaded.
    Starting server op port 8080 ... 
    Server started ...
    Connecting socket for: updatenotification
    Connecting socket for: calendar
    Starting node helper for: calendar
    Sockets connected & modules started ...
    Launching application.
    Create new calendar fetcher for url: http://springschedule.au.dk/ical/ical.asp?objectclass=student&id=xxxxxx - Interval: 300000
    
    

    Shouldn’t the logs be visible in the command line?

    S I 2 Replies Last reply Feb 21, 2017, 9:33 PM Reply Quote 0
    • S Offline
      strawberry 3.141 Project Sponsor Module Developer @mortenbirkelund
      last edited by Feb 21, 2017, 9:33 PM

      @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

      Please create a github issue if you need help, so I can keep track

      Y 1 Reply Last reply Feb 21, 2017, 9:36 PM Reply Quote 0
      • I Offline
        izanbard @mortenbirkelund
        last edited by Feb 21, 2017, 9:35 PM

        @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.

        1 Reply Last reply Reply Quote 1
        • Y Offline
          yawns Moderator @strawberry 3.141
          last edited by yawns Feb 21, 2017, 9:37 PM Feb 21, 2017, 9:36 PM

          @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 there

          Ah, @izanbard was faster :-)

          1 Reply Last reply Reply Quote 0
          • M Offline
            mortenbirkelund
            last edited by Feb 21, 2017, 9:41 PM

            @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.

            I 1 Reply Last reply Feb 21, 2017, 9:42 PM Reply Quote 0
            • I Offline
              izanbard @mortenbirkelund
              last edited by Feb 21, 2017, 9:42 PM

              @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)

              1 Reply Last reply Reply Quote 0
              • M Offline
                mortenbirkelund
                last edited by Feb 21, 2017, 11:02 PM

                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;
                	}
                	
                });
                
                1 Reply Last reply Reply Quote 0
                • M Offline
                  mortenbirkelund
                  last edited by Feb 21, 2017, 11:48 PM

                  @Snille I have looked at your button module for inspiration. Do you know why nothing happens when I click the button?

                  1 Reply Last reply Reply Quote 0
                  • M Offline
                    mortenbirkelund
                    last edited by Feb 22, 2017, 9:44 AM

                    Found the error. I needed to add

                    .region.fullscreen {
                    z-index: -1;
                    }

                    as css and now it is working.

                    1 Reply Last reply Reply Quote 0
                    • S Offline
                      Snille Module Developer
                      last edited by Feb 22, 2017, 9:56 AM

                      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.

                      If you cant find it, make it and share it!
                      Modules: MMM-homeassistant-sensors, MMM-Modulebar, MMM-Profilepicture, MMM-Videoplayer

                      1 Reply Last reply Reply Quote 0
                      • 1
                      • 2
                      • 1 / 2
                      1 / 2
                      • First post
                        7/19
                        Last post
                      Enjoying MagicMirror? Please consider a donation!
                      MagicMirror created by Michael Teeuw.
                      Forum managed by Sam, technical setup by Karsten.
                      This forum is using NodeBB as its core | Contributors
                      Contact | Privacy Policy