Refactoring: Extract showMachineInfo function

This commit is contained in:
syuilo 2019-02-05 06:49:00 +09:00
parent 6bda571660
commit 7d730f676d
No known key found for this signature in database
GPG key ID: BDC4C49D06AB9D69
2 changed files with 17 additions and 14 deletions

View file

@ -0,0 +1,15 @@
import * as os from 'os';
import * as sysUtils from 'systeminformation';
import Logger from "./logger";
export async function showMachineInfo(parentLogger: Logger) {
const logger = parentLogger.createSubLogger('machine');
logger.debug(`Hostname: ${os.hostname()}`);
logger.debug(`Platform: ${process.platform}`);
logger.debug(`Architecture: ${process.arch}`);
logger.debug(`CPU: ${os.cpus().length} core`);
const mem = await sysUtils.mem();
const totalmem = (mem.total / 1024 / 1024 / 1024).toFixed(1);
const availmem = (mem.available / 1024 / 1024 / 1024).toFixed(1);
logger.debug(`MEM: ${totalmem}GB (available: ${availmem}GB)`);
}