Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Development documentation (MM issue #3252) #218

Open
wants to merge 7 commits into
base: develop
Choose a base branch
from

Conversation

jkriegshauser
Copy link

@jkriegshauser jkriegshauser commented Dec 31, 2023

Resolves MagicMirror issue MagicMirrorOrg/MagicMirror#3252

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

core-development/testing.md Outdated Show resolved Hide resolved
@jkriegshauser
Copy link
Author

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

@sdetweil
Copy link
Collaborator

sdetweil commented Jan 9, 2024

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
Copy link
Collaborator

sdetweil commented Jan 9, 2024

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
Copy link
Collaborator

sdetweil commented Jan 9, 2024

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
Copy link
Collaborator

sdetweil commented Jan 9, 2024

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

@jkriegshauser
Copy link
Author

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

@sdetweil
Copy link
Collaborator

sdetweil commented Jan 9, 2024

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
Copy link
Collaborator

sdetweil commented Jan 9, 2024

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
Copy link
Collaborator

sdetweil commented Jan 9, 2024

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

Copy link
Collaborator

@rejas rejas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add redirects for the old urls so that links from the forum (or other sources) can find the new urls?

See vuejs/vuepress#239 (comment) on how to do it

@jkriegshauser
Copy link
Author

@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
Copy link
Author

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

@rejas
Copy link
Collaborator

rejas commented Feb 3, 2024

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

Comment on lines +3 to +10
{ path: '/development/introduction.html', redirect: '/module-development/introduction.html' },
{ path: '/development/core-module-file.html', redirect: '/module-development/core-module-file.html' },
{ path: '/development/node-helper.html', redirect: '/module-development/node-helper.html' },
{ path: '/development/helper-methods.html', redirect: '/module-development/helper-methods.html' },
{ path: '/development/logger.html', redirect: '/module-development/logger.html' },
{ path: '/development/notifications.html', redirect: '/module-development/notifications.html' },
{ path: '/development/weather-provider.html', redirect: '/module-development/weather-provider.html' },
{ path: '/development/documentation.html', redirect: '/module-development/documentation.html' }
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, this makes a lot more sense now 👍

@jkriegshauser
Copy link
Author

@rejas looks good! Thanks for doing that 👍

@sdetweil
Copy link
Collaborator

sdetweil commented Feb 3, 2024

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

@jkriegshauser
Copy link
Author

@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

Copy link
Collaborator

@rejas rejas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am fine with the changes. Would love to hear from @sdetweil if we can merge it or if there is still issues with the windows notation?

@jkriegshauser
Copy link
Author

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

@sdetweil
Copy link
Collaborator

sorry been swamped will do tonight

Copy link
Collaborator

@sdetweil sdetweil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks ok.. windows start is ok (tested)

lot of things I would change, don't have time now.
npm start doesn't work over ssh.. not true, we fixed that ages ago
(3 of the 4 in this section are not true)

development guide.. the last section on creating node app doesn't apply to MM.

debugging

The [MMM-Logging](https://github.com/shbatm/MMM-Logging) module can help to gather logs and output to a file, but at a performance cost.

should used MMRIZE's MMM-LogExt much better.. MMM-Logging not updated in forever

@jkriegshauser
Copy link
Author

@sdetweil thanks, I'll make some tweaks today

@rejas
Copy link
Collaborator

rejas commented Oct 31, 2024

@sdetweil thanks, I'll make some tweaks today

@jkriegshauser are those tweaks still in progess? or whats the status of this PR in your opinion?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants