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

TypeScript safe.gray函数代码示例

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

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



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

示例1: write

    write(log: string) {
        if (this.isEnabled) {            
            let logJson = JSON.parse(log);
            let time = new Date(logJson.time);
            let timestamp = `${time.getHours()}:${time.getMinutes()}:${time.getSeconds()}.${time.getMilliseconds()}`;
            switch (logJson.eventType) {
                case 'IncomingServiceRequest':
                    console.log(`[${colors.gray(timestamp)}]: ${colors.magenta('Incoming')} (${colors.magenta(logJson.requestMethod + ':' + logJson.requestUri)}) -> ${colors.cyan(logJson.operationName)}: ${logJson.responseStatusCode >= 200 && logJson.responseStatusCode < 400 ? colors.green('SUCCESS') : colors.red('FAILURE')} (${logJson.latencyMs}ms)`);
                    break;
                case 'OutgoingServiceRequest':
                    let host: string = logJson.hostname;
                    if (host.includes('HostName')) {
                        // Otherwise use HostName for host if available
                        host = host
                            .split(';')
                            .filter((part: string): boolean => part.startsWith('HostName'))
                            .reduce((acc: string, val: string): string => val.split('=')[1], host);
                    }

                    console.log(`[${colors.gray(timestamp)}]: ${colors.magenta('Outgoing')} ${colors.magenta(logJson.context)} => (${colors.magenta(logJson.operationName)}) -> ${colors.cyan(host)}: ${logJson.succeeded ? colors.green('SUCCESS') : colors.red('FAILURE')} (${logJson.latencyMs}ms)`);
                    break;
                case 'Exception':
                    console.log(`[${colors.gray(timestamp)}]: ${colors.red('Exception')}:\n${colors.red(logJson.errorDetails)}`);
                    break;
            }
        }
    }
开发者ID:habukira,项目名称:Azure-azure-iot-device-management,代码行数:27,代码来源:dmuxLogStream.ts


示例2: log

	connection.on('misskey.log', (data: any) => {
		const date = data.date;
		const method = data.method;
		const host = data.host;
		const path = data.path;
		const ua = data.ua;
		const ip = data.ip;
		const worker = data.worker;

		/* tslint:disable max-line-length */
		log(`${colors.gray(date)} ${method} ${colors.cyan(host)} ${colors.bold(path)} ${ua} ${colors.green(ip)} ${colors.gray('(' + worker + ')')}`);
		/* tslint:enable max-line-length */
	});
开发者ID:syuilo,项目名称:misskey-web-logger,代码行数:13,代码来源:cli.ts


示例3: prettyPrintWarning

 function prettyPrintWarning(warning) {
   if (warning.fatal) {
     fatalFailureOccurred = true;
   }
   const warningText = colors.red(warning.filename) + ":" +
                     warning.location.line + ":" + warning.location.column +
                     "\n    " + colors.gray(warning.message);
   logger.warn(warningText);
 }
开发者ID:PolymerLabs,项目名称:polylint,代码行数:9,代码来源:cli.ts


示例4:

	console.log(colors.green("git status is good - I can continue..."));
}

const releaseTypes = ["major", "premajor", "minor", "preminor", "patch", "prepatch", "prerelease"];

const releaseType = argv._[0] || "patch";
let newVersion = releaseType;
const oldVersion = pack.version as string;
if (releaseTypes.indexOf(releaseType) > -1) {
	if (releaseType.startsWith("pre") && argv._.length >= 2) {
		// increment to pre-release with an additional prerelease string
		newVersion = semver.inc(oldVersion, releaseType, argv._[1]);
	} else {
		newVersion = semver.inc(oldVersion, releaseType);
	}
	console.log(`bumping version ${colors.blue(oldVersion)} to ${colors.gray(releaseType)} version ${colors.green(newVersion)}\n`);
} else {
	// increment to specific version
	newVersion = semver.clean(newVersion);
	if (newVersion == null) {
		fail(`invalid version string "${newVersion}"`);
	} else {
		// valid version string => check if its actually newer
		if (!semver.gt(newVersion, pack.version)) {
			fail(`new version ${newVersion} is NOT > than package.json version ${pack.version}`);
		}
		// if (!semver.gt(newVersion, ioPack.common.version)) {
		// 	fail(`new version ${newVersion} is NOT > than io-package.json version ${ioPack.common.version}`);
		// }
	}
	console.log(`bumping version ${oldVersion} to specific version ${newVersion}`);
开发者ID:AlCalzone,项目名称:shared-utils,代码行数:31,代码来源:release.ts


示例5: recurse

function recurse() {
  rl.setPrompt(colors.gray(ix + "| "), (`${ix}| `).length);
  rl.prompt();
}
开发者ID:AtnNn,项目名称:Eve,代码行数:4,代码来源:repl.ts


示例6: complete

function complete(line) {
    return [["asdf"], line];
}

var rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout,
//   completer: complete,
});

var ix = 1;
var current = "";
var me = uuid();

var separator = colors.gray("------------------------------------------------------------");

let CURSOR_UP_ONE = '\x1b[1A';

rl.on("line", function(answer) {
    current += answer;
    ix++;
    if(answer === "") {
        ix = 1;
        if(current) {
            rl.write(CURSOR_UP_ONE + CURSOR_UP_ONE);
            rl.clearLine();
            console.log("   ");
            try {
                let code = current.trim();
                if(current.indexOf("(query") !== 0
开发者ID:AtnNn,项目名称:Eve,代码行数:30,代码来源:repl.ts



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
TypeScript safe.green函数代码示例发布时间:2022-05-25
下一篇:
TypeScript safe.cyan函数代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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