2023-01-13 05:40:33 +01:00
|
|
|
import * as os from "node:os";
|
2023-11-26 21:33:46 +01:00
|
|
|
import sysUtils from "systeminformation";
|
2023-12-05 08:12:10 +01:00
|
|
|
import type Logger from "@/services/logger.js";
|
2019-02-04 22:49:00 +01:00
|
|
|
|
|
|
|
export async function showMachineInfo(parentLogger: Logger) {
|
2023-01-13 05:40:33 +01:00
|
|
|
const logger = parentLogger.createSubLogger("machine");
|
2019-02-04 22:49:00 +01:00
|
|
|
logger.debug(`Hostname: ${os.hostname()}`);
|
2019-02-20 14:05:34 +01:00
|
|
|
logger.debug(`Platform: ${process.platform} Arch: ${process.arch}`);
|
2019-02-04 22:49:00 +01:00
|
|
|
const mem = await sysUtils.mem();
|
|
|
|
const totalmem = (mem.total / 1024 / 1024 / 1024).toFixed(1);
|
|
|
|
const availmem = (mem.available / 1024 / 1024 / 1024).toFixed(1);
|
2023-01-13 05:40:33 +01:00
|
|
|
logger.debug(
|
|
|
|
`CPU: ${
|
|
|
|
os.cpus().length
|
|
|
|
} core MEM: ${totalmem}GB (available: ${availmem}GB)`,
|
|
|
|
);
|
2019-02-04 22:49:00 +01:00
|
|
|
}
|