cd ~ git clone https://github.com/lorenzfleerackers/MagicMirrorLogging.git
When you cloned the repo copy the logging.py file to the MagicMirror directory.
cp ~/MagicMirrorLogging/logging.py ~/MagicMirror
cd ~/MagicMirror nano package.json
Add the following lines
"start:log": "python logging.py", "start:searchLog": "python /home/pi/MagicMirrorLogging/localLogging.py",
after :
"start": "sh run-start.sh",
Save the file end leave
Install express-logging to log the HTTP requests
If you want to log the http requests that you made or those from MMM-Remote-Control or MMM-ChangeConfig
- Go to the module you want to log (this can be your own module or the one from above)
- Install the package with
- npm install express-logging
- npm install logops
- Open the node_helper or the javascript file where you define your API's with express
- add the folowing code
var express = require('express'), expressLogging = require('express-logging'), logger = require('logops'); var app = express(); app.use(expressLogging(logger));
You can start the Magic Mirror with only showing the info/logs/error or the HTTP requests.
options | explanation |
---|---|
Start mirror without options | Start the mirror and show all the logs,errors and requests |
Show info | With this option the mirror will start and you will see console.info logs from all the modules without showing other errors or logs |
Show logs | With this option the mirror will start and you will seee console.log logs from all the modules without showing other errors or info |
Show errors | With this option the mirror will start and show only the errors without all the logs or info |
Show requests | With this option you will start the magic mirror without showing any logs or errors only the http requests from express-logging will be visible |
Leave | Quit the option list without starting the mirror |
options | explanation |
---|---|
Logging to file | The logs will be saved to the log.log file and the errors will be saved to err.log |
No logging | No logs will be saved to a file |
options | explanation |
---|---|
Show info | Show all the info from the logfile in the terminal |
Show logs | You can filter all the logs from the logfile on date/modulename |
Show errors | Show the error log file in the terminal |
Show requests | Show all the http requests from the logfile in the terminal |
Quit | Stop the loop |