mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-07-01 13:33:15 +00:00
Add systeminfo (#3331)
This is a first attempt to bring additional system information into the console (see #3328). It's certainly not yet perfect, but with the PR we have a better basis for discussion. I tried to keep the output small so that we get as much information as possible in screenshots. This is how it looks on my development system. ```bash [03.01.2024 00:50.19.226] [INFO] System information: ### SYSTEM: manufacturer: Notebook; model: N650DU; raspberry: undefined; virtual: false ### OS: platform: linux; distro: Debian GNU/Linux; release: 12 ### VERSIONS: MagicMirror: 2.27.0-develop; electron: 27.2.0; kernel: 5.10.0-20-amd64; node: 21.1.0; npm: 10.2.4; pm2: 5.3.0; docker: 20.10.24+dfsg1 ``` Why is it still a draft: - [x] I have doubts that utils.js is the right place for the function. What do you think? => Update: As long as there is no better idea, it stays there. - [x] Instead of working through all wishes you expressed in the issue #3328, I only implemented what was easy to achieve. And wanted to hear what you think about this approach. => Update: Some added. Of course, more information could be added later, as soon as experience has been gained in productive use. - [x] I don't quite like the introductory line ("The following lines provide information..."). Should I perhaps simply replace it with "System information:"? => Update: Changed to "System information:" [Here](https://github.com/sebhildebrandt/systeminformation#function-reference-and-os-support) you can see what information we could easily add with the systeminformation package. It would be interesting how the raspberry field is filled on a raspi system and with docker there should be another line, but I can't easily test that now.
This commit is contained in:
parent
5f7b56e645
commit
6097547c10
@ -3,7 +3,7 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
This project adheres to [Semantic Versioning](https://semver.org/).
|
||||
|
||||
❤️ **Donate:** Enjoying MagicMirror²? [Please consider a donation!](https://magicmirror.builders/donate) With your help we can continue to improve the MagicMirror².
|
||||
❤️ **Donate:** Enjoying MagicMirror²? [Please consider a donation!](https://magicmirror.builders/#donate) With your help we can continue to improve the MagicMirror².
|
||||
|
||||
## [2.27.0] - Develop Branch (unreleased)
|
||||
|
||||
@ -11,6 +11,8 @@ _This release is scheduled to be released on 2024-04-01._
|
||||
|
||||
### Added
|
||||
|
||||
- Output of system information to the console for troubleshooting (#3328).
|
||||
|
||||
### Updated
|
||||
|
||||
### Fixed
|
||||
|
@ -21,6 +21,9 @@ const defaultModules = require(`${__dirname}/../modules/default/defaultmodules`)
|
||||
global.version = require(`${__dirname}/../package.json`).version;
|
||||
Log.log(`Starting MagicMirror: v${global.version}`);
|
||||
|
||||
// Log system information.
|
||||
Utils.logSystemInformation();
|
||||
|
||||
// global absolute root path
|
||||
global.root_path = path.resolve(`${__dirname}/../`);
|
||||
|
||||
|
16
js/utils.js
16
js/utils.js
@ -5,6 +5,8 @@
|
||||
* MIT Licensed.
|
||||
*/
|
||||
const colors = require("colors/safe");
|
||||
const Log = require("logger");
|
||||
const si = require("systeminformation");
|
||||
|
||||
module.exports = {
|
||||
colors: {
|
||||
@ -12,5 +14,19 @@ module.exports = {
|
||||
error: colors.red,
|
||||
info: colors.blue,
|
||||
pass: colors.green
|
||||
},
|
||||
|
||||
async logSystemInformation () {
|
||||
try {
|
||||
const staticData = await si.getStaticData();
|
||||
let systemDataString = "System information:";
|
||||
systemDataString += `\n ### SYSTEM: manufacturer: ${staticData["system"]["manufacturer"]}; model: ${staticData["system"]["model"]}; raspberry: ${staticData["system"]["raspberry"]}; virtual: ${staticData["system"]["virtual"]}`;
|
||||
systemDataString += `\n ### OS: platform: ${staticData["os"]["platform"]}; distro: ${staticData["os"]["distro"]}; release: ${staticData["os"]["release"]}; arch: ${staticData["os"]["arch"]}; kernel: ${staticData["versions"]["kernel"]}`;
|
||||
systemDataString += `\n ### VERSIONS: electron: ${process.versions.electron}; node: ${staticData["versions"]["node"]}; npm: ${staticData["versions"]["npm"]}; pm2: ${staticData["versions"]["pm2"]}; docker: ${staticData["versions"]["docker"]}`;
|
||||
systemDataString += `\n ### OTHER: timeZone: ${Intl.DateTimeFormat().resolvedOptions().timeZone}`;
|
||||
Log.info(systemDataString);
|
||||
} catch (e) {
|
||||
Log.error(e);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
28
package-lock.json
generated
28
package-lock.json
generated
@ -24,7 +24,8 @@
|
||||
"module-alias": "^2.2.3",
|
||||
"moment": "^2.30.1",
|
||||
"node-ical": "^0.17.1",
|
||||
"socket.io": "^4.7.2"
|
||||
"socket.io": "^4.7.2",
|
||||
"systeminformation": "^5.21.22"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@stylistic/eslint-plugin": "^1.5.1",
|
||||
@ -9297,6 +9298,31 @@
|
||||
"integrity": "sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/systeminformation": {
|
||||
"version": "5.21.22",
|
||||
"resolved": "https://registry.npmjs.org/systeminformation/-/systeminformation-5.21.22.tgz",
|
||||
"integrity": "sha512-gNHloAJSyS+sKWkwvmvozZ1eHrdVTEsynWMTY6lvLGBB70gflkBQFw8drXXr1oEXY84+Vr9tOOrN8xHZLJSycA==",
|
||||
"os": [
|
||||
"darwin",
|
||||
"linux",
|
||||
"win32",
|
||||
"freebsd",
|
||||
"openbsd",
|
||||
"netbsd",
|
||||
"sunos",
|
||||
"android"
|
||||
],
|
||||
"bin": {
|
||||
"systeminformation": "lib/cli.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8.0.0"
|
||||
},
|
||||
"funding": {
|
||||
"type": "Buy me a coffee",
|
||||
"url": "https://www.buymeacoffee.com/systeminfo"
|
||||
}
|
||||
},
|
||||
"node_modules/table": {
|
||||
"version": "6.8.1",
|
||||
"resolved": "https://registry.npmjs.org/table/-/table-6.8.1.tgz",
|
||||
|
@ -85,7 +85,8 @@
|
||||
"module-alias": "^2.2.3",
|
||||
"moment": "^2.30.1",
|
||||
"node-ical": "^0.17.1",
|
||||
"socket.io": "^4.7.2"
|
||||
"socket.io": "^4.7.2",
|
||||
"systeminformation": "^5.21.22"
|
||||
},
|
||||
"lint-staged": {
|
||||
"*": "prettier --write",
|
||||
|
Loading…
x
Reference in New Issue
Block a user