• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript log-cool.logWarn函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了TypeScript中log-cool.logWarn函数的典型用法代码示例。如果您正苦于以下问题:TypeScript logWarn函数的具体用法?TypeScript logWarn怎么用?TypeScript logWarn使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了logWarn函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。

示例1: checkDependency

function checkDependency(serviceName: string, command: string, transform: (x: string) => string): void {
	try {
		const x = execSync(command, { stdio: ['pipe', 'pipe', 'ignore'] });
		const ver = transform(x.toString());
		if (ver !== null) {
			logInfo(`${serviceName} ${ver}`);
		} else {
			logWarn(`Check dependencies error (${serviceName})`);
			logWarn(`Regexp used for version check of ${serviceName} is probably messed up`);
		}
	} catch (e) {
		logWarn(`Unable to find (${serviceName})`);
	}
}
开发者ID:Tosuke,项目名称:Misskey-API,代码行数:14,代码来源:check-dependencies.ts


示例2: init

/**
 * Init app
 */
async function init(): Promise<State> {
	console.log('Welcome to Misskey!\n');

	console.log(chalk.bold('Misskey Core <aoi>'));

	let warn = false;

	// Get commit info
	const commit = await prominence(git).getLastCommit();
	console.log(`commit: ${commit.shortHash} ${commit.author.name} <${commit.author.email}>`);
	console.log(`        ${new Date(parseInt(commit.committedOn, 10) * 1000)}`);

	console.log('\nInitializing...\n');

	if (IS_DEBUG) {
		logWarn('It is not in the Production mode. Do not use in the Production environment.');
	}

	logInfo(`environment: ${env}`);

	// Get machine info
	const totalmem = (os.totalmem() / 1024 / 1024 / 1024).toFixed(1);
	const freemem = (os.freemem() / 1024 / 1024 / 1024).toFixed(1);
	logInfo(`MACHINE: ${os.hostname()}`);
	logInfo(`MACHINE: CPU: ${os.cpus().length}core`);
	logInfo(`MACHINE: MEM: ${totalmem}GB (available: ${freemem}GB)`);

	if (!fs.existsSync(require('./config').configPath)) {
		logFailed('Configuration not found');
		return State.failed;
	}

	// Load config
	const conf = require('./config').default;

	logDone('Success to load configuration');
	logInfo(`maintainer: ${conf.maintainer}`);

	checkDependencies();

	// Check if a port is being used
	if (await portUsed.check(conf.port)) {
		logFailed(`Port: ${conf.port} is already used!`);
		return State.failed;
	}

	// Try to connect to MongoDB
	try {
		await initdb(conf);
		logDone('Success to connect to MongoDB');
	} catch (e) {
		logFailed(`MongoDB: ${e}`);
		return State.failed;
	}

	return warn ? State.warn : State.success;
}
开发者ID:syuilo,项目名称:misskey-core,代码行数:60,代码来源:index.ts


示例3: checkDependency

function checkDependency(serviceName: string, command: string, transform: (x: string) => string): void {
	const code = {
		success: 0,
		notFound: 127
	};
	const x = exec(command, { silent: true }) as any;
	if (x.code === code.success) {
		logInfo(`DEPS: ${serviceName} ${transform(x.stdout)}`);
	} else if (x.code === code.notFound) {
		logWarn(`Unable to find ${serviceName}`);
	}
}
开发者ID:syuilo,项目名称:misskey-core,代码行数:12,代码来源:check-dependencies.ts


示例4: notFoundHandler

function notFoundHandler(req: any, res: any): any {
	logWarn(`Request not handled: ${req.method.toUpperCase()} ${req.path}`);
	return res({
		error: 'api-not-found'
	}).code(404);
}
开发者ID:akionux,项目名称:Misskey-API,代码行数:6,代码来源:server.ts



注:本文中的log-cool.logWarn函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript log4js.configure函数代码示例发布时间:2022-05-28
下一篇:
TypeScript log-cool.logInfo函数代码示例发布时间:2022-05-28
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap