Skip to content
Snippets Groups Projects
Commit 7e4091c7 authored by Aya Morisawa's avatar Aya Morisawa
Browse files

Extract MachineInfo

parent 2fd6ddf8
No related branches found
No related tags found
No related merge requests found
......@@ -18,6 +18,7 @@ const portUsed = require('tcp-port-used');
const isRoot = require('is-root');
import ProgressBar from './utils/cli/progressbar';
import initdb from './db/mongodb';
import MachineInfo from './utils/machineInfo';
import DependencyChecker from './utils/dependencyChecker';
// Init babel
......@@ -158,14 +159,7 @@ async function init(): Promise<State> {
envLogger.warn('Do not use for production purpose');
}
// Get machine info
const totalmem = (os.totalmem() / 1024 / 1024 / 1024).toFixed(1);
const freemem = (os.freemem() / 1024 / 1024 / 1024).toFixed(1);
let machineLogger = new Logger('Machine');
machineLogger.info(os.hostname());
machineLogger.info(`CPU: ${os.cpus().length}core`);
machineLogger.info(`MEM: ${totalmem}GB (available: ${freemem}GB)`);
MachineInfo.show();
new DependencyChecker().checkAll();
let configLogger = new Logger('Config');
......
import * as os from 'os';
import Logger from './logger';
export default class MachineInfo {
static show() {
const totalmem = (os.totalmem() / 1024 / 1024 / 1024).toFixed(1);
const freemem = (os.freemem() / 1024 / 1024 / 1024).toFixed(1);
let logger = new Logger('Machine');
logger.info(os.hostname());
logger.info(`CPU: ${os.cpus().length}core`);
logger.info(`MEM: ${totalmem}GB (available: ${freemem}GB)`);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment