summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorsyuilo <syuilotan@yahoo.co.jp>2019-02-04 12:09:59 +0900
committersyuilo <syuilotan@yahoo.co.jp>2019-02-04 12:09:59 +0900
commit3be89e970291af3afed04d47c9f15ccf920ce82d (patch)
treed95dedf7e14b2c83ca022e9642ea95b846f86f6c /src
parentMake Logger#log method private (diff)
downloadsharkey-3be89e970291af3afed04d47c9f15ccf920ce82d.tar.gz
sharkey-3be89e970291af3afed04d47c9f15ccf920ce82d.tar.bz2
sharkey-3be89e970291af3afed04d47c9f15ccf920ce82d.zip
Better logging
Diffstat (limited to 'src')
-rw-r--r--src/index.ts16
-rw-r--r--src/misc/logger.ts10
2 files changed, 14 insertions, 12 deletions
diff --git a/src/index.ts b/src/index.ts
index a41960beaa..69e64737d4 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -70,6 +70,8 @@ async function masterMain() {
//#endregion
}
+ console.log(chalk`${os.hostname()} {gray (PID: ${process.pid.toString()})}`);
+
bootLogger.info('Welcome to Misskey!');
bootLogger.info(`Misskey v${pkg.version}`, true);
bootLogger.info('Misskey is maintained by @syuilo, @AyaMorisawa, @mei23 and @acid-chicken.');
@@ -118,14 +120,14 @@ async function isPortAvailable(port: number): Promise<boolean> {
async function showMachine() {
const logger = bootLogger.createSubLogger('machine');
- logger.info(`Hostname: ${os.hostname()}`);
- logger.info(`Platform: ${process.platform}`);
- logger.info(`Architecture: ${process.arch}`);
- logger.info(`CPU: ${os.cpus().length} core`);
+ 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.info(`MEM: ${totalmem}GB (available: ${availmem}GB)`);
+ logger.debug(`MEM: ${totalmem}GB (available: ${availmem}GB)`);
}
function showEnvironment(): void {
@@ -257,12 +259,12 @@ function spawnWorker(): Promise<void> {
// Listen new workers
cluster.on('fork', worker => {
- clusterLog.info(`Process forked: [${worker.id}]`);
+ clusterLog.debug(`Process forked: [${worker.id}]`);
});
// Listen online workers
cluster.on('online', worker => {
- clusterLog.succ(`Process is now online: [${worker.id}]`);
+ clusterLog.debug(`Process is now online: [${worker.id}]`);
});
// Listen for dying workers
diff --git a/src/misc/logger.ts b/src/misc/logger.ts
index abb3db6a3d..e086445b37 100644
--- a/src/misc/logger.ts
+++ b/src/misc/logger.ts
@@ -45,13 +45,13 @@ export default class Logger {
this.log(important ? chalk.bgGreen.white('DONE') : chalk.green('DONE'), chalk.green(message), important);
}
- public info(message: string, important = false): void { // それ以外
- this.log(chalk.blue('INFO'), message, important);
- }
-
- public debug(message: string, important = false): void { // デバッグ用に使う
+ public debug(message: string, important = false): void { // デバッグ用に使う(開発者にとっては必要だが利用者にとっては不要な情報)
if (process.env.NODE_ENV != 'production') {
this.log(chalk.gray('VERB'), chalk.gray(message), important);
}
}
+
+ public info(message: string, important = false): void { // それ以外
+ this.log(chalk.blue('INFO'), message, important);
+ }
}