MagicMirror-Documentation icon indicating copy to clipboard operation
MagicMirror-Documentation copied to clipboard

Development documentation (MM issue #3252)

Open jkriegshauser opened this issue 2 years ago • 19 comments

Resolves MagicMirror issue https://github.com/MichMich/MagicMirror/issues/3252

Renames development to module-development and adds new directory core-development with some info.

jkriegshauser avatar Dec 31 '23 21:12 jkriegshauser

@KristjanESPERANTO @rejas I'd like to add a blurb about logging but I actually haven't been able to figure it out myself! How do I enable logging, where do the log files go, etc.

jkriegshauser avatar Jan 09 '24 01:01 jkriegshauser

there are no log files. there are two places where info is reported. In the console where npm start/npm run server is done.

this output is separated into two types. normal, (console.log()) presented on the programs stdout stream and error, (console.error()) presented on the programs stderrr stream.

if you are using pm2, these two streams are captured separately, not comingled by time

if you are not using pm2, then the output will be lost unless you use redirection to pipe the output to some file

all this output is generated by the node_helper of every module that uses one

the second place is in the browser developers window console. this output is not captured by anything. one can use a module like MMM-Logging to redirect this output to the normal output stream. but it affects performance.

this browser output is collected from Log.log()/Log.error() statements in the browser component of a module. that's the JavaScript file that has the same name as the module.

sdetweil avatar Jan 09 '24 03:01 sdetweil

the calendar module uses console.debug() which is disabled by default. you can enable it by adding "DEBUG", to the logLevel property in config.js. and restarting MagicMirror

this output is presented on the programs stderrr stream.

only the calendar module uses this approach if you had multiple modules using it, then all their output would be generated at the same time

sdetweil avatar Jan 09 '24 03:01 sdetweil

if you are using pm2 to launch MagicMirror, then the command

pm2 logs --lines=nnnn

will display nnnn lines from each of the stderrr and stdout streams. (not joined by time) the nnnn default is the last 15 lines..

sdetweil avatar Jan 09 '24 03:01 sdetweil

when viewing the content collected from stdout and stderrr, there is no built in capability to identify the module that generated the output

in the browser developers window console, you can filter output by a using string found in the output, but not by module. by placing this string in the filter field of the console tab

sdetweil avatar Jan 09 '24 03:01 sdetweil

@sdetweil thanks, I'll digest this info and then write a portion in the core development documentation about it

jkriegshauser avatar Jan 09 '24 16:01 jkriegshauser

you can open the browser developers window with the keystroke combination ctrl-shift-i on the browser showing MM (its a toggle, turn on, turn off) the browser dev window, console tab looks like this

Screenshot at 2024-01-09 11-11-51

sdetweil avatar Jan 09 '24 17:01 sdetweil

and then there is the elements tab where you can see and manipulate the styles on elements before adding them to custom.css

see this for discussion on how to use https://forum.magicmirror.builders/topic/14862/help-with-a-couple-css-issues?_=1704737779315

sdetweil avatar Jan 09 '24 17:01 sdetweil

and there is the sources tab where you can see and step thru the browser side code. see and manipulate variables

sdetweil avatar Jan 09 '24 17:01 sdetweil

@rejas I'm not really sure what needs to be redirected, or how to implement it based on the vuejs link. It seems like all of the old references in the current documentation develop branch have been updated.

jkriegshauser avatar Feb 02 '24 22:02 jkriegshauser

@sdetweil I've added documentation around your logging info, please review (and thanks!)

jkriegshauser avatar Feb 02 '24 22:02 jkriegshauser

@rejas I'm not really sure what needs to be redirected, or how to implement it based on the vuejs link. It seems like all of the old references in the current documentation develop branch have been updated.

I took the liberty to add the redirects and commit them to your branch (as well as some linting to your new pages). How do you think about it?

rejas avatar Feb 03 '24 22:02 rejas

@rejas looks good! Thanks for doing that 👍

jkriegshauser avatar Feb 03 '24 23:02 jkriegshauser

maybe another change, remove the leading

.\\

on the windows package.json change

windows doesn't support . for current directory

needs to start

"node_modules\\.bin

sdetweil avatar Feb 03 '24 23:02 sdetweil

@sdetweil

maybe another change, remove the leading .\\ ...

This works fine on Windows. Windows development with MM isn't great but I do at least some of my development there, and this works fine. You just can't have the DISPLAY=... bit in the start script in package.json

jkriegshauser avatar Feb 05 '24 01:02 jkriegshauser

It's been a week, where are we at on this? Still waiting on @sdetweil?

jkriegshauser avatar Feb 21 '24 00:02 jkriegshauser

sorry been swamped will do tonight

sdetweil avatar Feb 21 '24 00:02 sdetweil

@sdetweil thanks, I'll make some tweaks today

jkriegshauser avatar Feb 21 '24 16:02 jkriegshauser