Merge environmentInfo and machineInfo into index.ts (#3319)
This commit is contained in:
@ -1,17 +0,0 @@
|
||||
import Logger from './logger';
|
||||
import isRoot = require('is-root');
|
||||
|
||||
export default class {
|
||||
public static show(): void {
|
||||
const env = process.env.NODE_ENV;
|
||||
const logger = new Logger('Env');
|
||||
logger.info(typeof env == 'undefined' ? 'NODE_ENV is not set' : `NODE_ENV: ${env}`);
|
||||
|
||||
if (env !== 'production') {
|
||||
logger.warn('The environment is not in production mode');
|
||||
logger.warn('Do not use for production purpose');
|
||||
}
|
||||
|
||||
logger.info(`You ${isRoot() ? '' : 'do not '}have root privileges`);
|
||||
}
|
||||
}
|
@ -1,17 +0,0 @@
|
||||
import * as os from 'os';
|
||||
import Logger from './logger';
|
||||
import * as sysUtils from 'systeminformation';
|
||||
|
||||
export default class {
|
||||
public static async show() {
|
||||
const logger = new Logger('Machine');
|
||||
logger.info(`Hostname: ${os.hostname()}`);
|
||||
logger.info(`Platform: ${process.platform}`);
|
||||
logger.info(`Architecture: ${process.arch}`);
|
||||
logger.info(`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.info(`MEM: ${totalmem}GB (available: ${availmem}GB)`);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user