当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript safe.magenta函数代码示例

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


在下文中一共展示了magenta函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: info

export function info(args:Array) {
    var text = '';
    for (var i = 0; i < args.length; i++) {
        var obj = args[i];
        text += colors.magenta(obj);
    }
    logger2.info(text);
}
开发者ID:MirekSz,项目名称:expressik,代码行数:8,代码来源:lib.ts

示例3: async

	}, async (_, result) => {
		if (result.password !== result.confirmPass) {
			console.log(magenta('\nPasswords do not match.\n\n'));
			createPwd();
		} else {
			/**
			 * Create new SimpleWallet
			 * Open it to access the new Account
			 * Print account info
			 */
			const wallet = createSimpleWallet(result.password);
			const pass = new Password(result.password);
			const account = wallet.open(pass);
			const address = account.address.pretty();
			console.log(green(`${MOSAIC_NAME} wallet successfully created.`));
			console.log(white(`You can now start sending and receiving ${MOSAIC_NAME}!`));
			console.log(white(`\n${MOSAIC_NAME} Public Address:`));
			console.log(yellow(`${address}`));
			console.log(white(`\nPrivate Key:`));
			console.log(yellow(`${account.privateKey}`));
			await downloadWallet(wallet);
		}
	})
开发者ID:devslopes,项目名称:mosaic-cli-wallet,代码行数:23,代码来源:wallet-cli.ts

示例4: require

 ws.on("error", () => {
     console.log(colors.red("No server running."));
     console.log(colors.magenta("Starting server.."));
     server = require("./server");
     connectToServer();
 });
开发者ID:AtnNn,项目名称:Eve,代码行数:6,代码来源:repl.ts

示例5: open

 ws.on('open', function open() {
     console.log(colors.magenta("Connected to ws://localhost:8080"));
     console.log(separator);
     console.log("");
     recurse();
 });
开发者ID:AtnNn,项目名称:Eve,代码行数:6,代码来源:repl.ts


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