0
0

Use logger

This commit is contained in:
Aya Morisawa 2016-12-29 17:50:57 +09:00
parent d55bedc02f
commit dc21a819d6
2 changed files with 6 additions and 7 deletions

View File

@ -133,22 +133,22 @@ function worker(): void {
* Init app * Init app
*/ */
async function init(): Promise<State> { async function init(): Promise<State> {
console.log('Welcome to Misskey!\n'); log('Info', 'Welcome to Misskey!');
console.log(chalk.bold('Misskey Core <aoi>')); log('Info', chalk.bold('Misskey Core <aoi>'));
let warn = false; let warn = false;
// Get commit info // Get commit info
try { try {
const commit = await prominence(git).getLastCommit(); const commit = await prominence(git).getLastCommit();
console.log(`commit: ${commit.shortHash} ${commit.author.name} <${commit.author.email}>`); log('Info', `commit: ${commit.shortHash} ${commit.author.name} <${commit.author.email}>`);
console.log(` ${new Date(parseInt(commit.committedOn, 10) * 1000)}`); log('Info', ` ${new Date(parseInt(commit.committedOn, 10) * 1000)}`);
} catch (e) { } catch (e) {
// noop // noop
} }
console.log('\nInitializing...\n'); log('Info', 'Initializing...');
if (IS_DEBUG) { if (IS_DEBUG) {
log('Warn', 'It is not in the Production mode. Do not use in the Production environment.'); log('Warn', 'It is not in the Production mode. Do not use in the Production environment.');
@ -219,5 +219,5 @@ function spawn(callback: any): void {
// Dying away... // Dying away...
process.on('exit', () => { process.on('exit', () => {
console.log('Bye.'); log('Info', 'Bye.');
}); });

View File

@ -6,7 +6,6 @@ export default function(): void {
checkDependency('npm', 'npm -v', x => x.match(/^(.*)\r?\n$/)[1]); checkDependency('npm', 'npm -v', x => x.match(/^(.*)\r?\n$/)[1]);
checkDependency('MongoDB', 'mongo --version', x => x.match(/^MongoDB shell version: (.*)\r?\n$/)[1]); checkDependency('MongoDB', 'mongo --version', x => x.match(/^MongoDB shell version: (.*)\r?\n$/)[1]);
checkDependency('Redis', 'redis-server --version', x => x.match(/v=([0-9\.]*)/)[1]); checkDependency('Redis', 'redis-server --version', x => x.match(/v=([0-9\.]*)/)[1]);
log('Info', 'Successfully checked external dependencies');
} }
function checkDependency(serviceName: string, command: string, transform: (x: string) => string): void { function checkDependency(serviceName: string, command: string, transform: (x: string) => string): void {