egirlskey/src/misc/machineInfo.ts

16 lines
542 B
TypeScript
Raw Normal View History

2016-12-30 18:19:59 +00:00
import * as os from 'os';
import Logger from './logger';
2017-01-02 19:39:44 +00:00
export default class {
2017-05-24 11:50:17 +00:00
public static show(): void {
2016-12-30 18:19:59 +00:00
const totalmem = (os.totalmem() / 1024 / 1024 / 1024).toFixed(1);
const freemem = (os.freemem() / 1024 / 1024 / 1024).toFixed(1);
2017-05-24 11:50:17 +00:00
const logger = new Logger('Machine');
2017-01-02 19:35:32 +00:00
logger.info(`Hostname: ${os.hostname()}`);
logger.info(`Platform: ${process.platform}`);
logger.info(`Architecture: ${process.arch}`);
2018-07-14 13:53:30 +00:00
logger.info(`CPU: ${os.cpus().length} core`);
2016-12-30 18:19:59 +00:00
logger.info(`MEM: ${totalmem}GB (available: ${freemem}GB)`);
}
}