本文整理汇总了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;
}
}
}
示例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);
}
示例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);
}
})
示例4: require
ws.on("error", () => {
console.log(colors.red("No server running."));
console.log(colors.magenta("Starting server.."));
server = require("./server");
connectToServer();
});
示例5: open
ws.on('open', function open() {
console.log(colors.magenta("Connected to ws://localhost:8080"));
console.log(separator);
console.log("");
recurse();
});