parent
129f652dc2
commit
a38e4b0b14
11 changed files with 40 additions and 47 deletions
|
|
@ -2,7 +2,7 @@ import * as cluster from 'cluster';
|
|||
import * as os from 'os';
|
||||
import * as chalk from 'chalk';
|
||||
import * as dateformat from 'dateformat';
|
||||
import { program } from '../argv';
|
||||
import { envOption } from '../env';
|
||||
import { getRepository } from 'typeorm';
|
||||
import { Log } from '@/models/entities/log';
|
||||
import { genId } from '@/misc/gen-id';
|
||||
|
|
@ -52,7 +52,7 @@ export default class Logger {
|
|||
}
|
||||
|
||||
private log(level: Level, message: string, data?: Record<string, any> | null, important = false, subDomains: Domain[] = [], store = true): void {
|
||||
if (program.quiet) return;
|
||||
if (envOption.quiet) return;
|
||||
if (!this.store) store = false;
|
||||
if (level === 'debug') store = false;
|
||||
|
||||
|
|
@ -80,7 +80,7 @@ export default class Logger {
|
|||
null;
|
||||
|
||||
let log = `${l} ${worker}\t[${domains.join(' ')}]\t${m}`;
|
||||
if (program.withLogTime) log = chalk.gray(time) + ' ' + log;
|
||||
if (envOption.withLogTime) log = chalk.gray(time) + ' ' + log;
|
||||
|
||||
console.log(important ? chalk.bold(log) : log);
|
||||
|
||||
|
|
@ -132,7 +132,7 @@ export default class Logger {
|
|||
}
|
||||
|
||||
public debug(message: string, data?: Record<string, any> | null, important = false): void { // デバッグ用に使う(開発者に必要だが利用者に不要な情報)
|
||||
if (process.env.NODE_ENV != 'production' || program.verbose) {
|
||||
if (process.env.NODE_ENV != 'production' || envOption.verbose) {
|
||||
this.log('debug', message, data, important);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue