本文整理汇总了TypeScript中colors/safe.cyan函数的典型用法代码示例。如果您正苦于以下问题:TypeScript cyan函数的具体用法?TypeScript cyan怎么用?TypeScript cyan使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了cyan函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: config
export function config(op: string, args: string[]) {
log.header('Configuration Manager');
switch (op) {
case "list": {
log.log(colors.cyan('Global'), 'options:');
var allConf = Common.iterateStringKeyObject<any>(conf.all);
allConf.forEach(v => {
if (!v.key.startsWith('repo_')) {
log.log(v.key, "=", v.value);
}
});
var repo = Common.cwdRepo();
if (!!repo) {
var lc = conf.get('repo_' + repo.name);
if (!!lc) {
log.log(colors.cyan('Local repository'), 'options:');
Common.iterateStringKeyObject<any>(lc).forEach(v => {
log.log(v.key, "=", v.value);
});
}
}
break;
}
case "set": {
if (args.length < 2) {
log.error('Not enough arguments for set operation.' +
'You must specify both key and value to set.');
return;
}
conf.set(args[0], args[1]);
log.log(args[0], '=', conf.get(args[0]));
break;
}
default: {
log.error('unknown operation');
break;
}
}
}
开发者ID:STALKER2010,项目名称:jerk,代码行数:44,代码来源:cli.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: require
digitMatrices.forEach((matrix: IDigitMatrix) => {
let outputs = this.neuralNetwork.runWith(matrix.matrix);
let maximumValue = -Infinity;
let minimumValue = +Infinity;
let maximumNeuron = NaN;
for (let i = 0; i < outputs.length; i++) {
if (outputs[i] > maximumValue) {
maximumValue = outputs[i];
maximumNeuron = i;
}
if (outputs[i] < minimumValue) {
minimumValue = outputs[i];
}
}
let correct: boolean = maximumNeuron === matrix.digit;
if (correct) {
correctGuesses++;
}
if (print) {
let colors = require('colors/safe');
console.log();
let expected = 'Expected > ' + colors.green(matrix.digit);
let actual = 'Actual > ' + (correct ? colors.green(maximumNeuron) : colors.red(maximumNeuron));
Util.logTest('Output: ' + expected + ' ' + actual);
Util.logTest();
let result = 'CORRECT GUESS';
if (correct) {
result = colors.green(result);
} else {
result = colors.red('IN' + result);
}
Util.logTest(result);
Util.logTest();
Util.logTest('Neuron outputs:');
Util.logTest();
let valueRange = Math.abs(maximumValue - minimumValue);
for (let i = 0; i < outputs.length; i++) {
let neuronIndex = colors.cyan(i);
let prefix = ' ';
let suffix = ' ';
if (i === maximumNeuron) {
prefix = ' > ';
suffix = ' < ';
}
let neuronOutput = outputs[i];
let normalisedOutput = Math.floor((neuronOutput - minimumValue) / valueRange * 9);
let line = '';
for (let k = 0; k < 10; k++) {
if (k === normalisedOutput) {
line += colors.bgYellow(colors.black('â'));
} else {
line += colors.bgYellow(' ');
}
}
Util.logTest(prefix + neuronIndex + ' ' + line + ' ' + neuronIndex + suffix);
}
Util.logTest();
Util.logTest('Image of the digit:');
Util.logTest();
let printFunction = correct ? colors.green : colors.red;
DataParser.printImage(matrix.matrix, (line: string) => Util.logTest(printFunction(line)));
console.log();
}
});
开发者ID:TimboKZ,项目名称:js-digit-recognition,代码行数:65,代码来源:DigitClassifier.ts
示例4: format
formatter.on('Factor', (instance: FactorNode, format: (instance: IMathsNode) => string): string => {
return instance.bracketed ? (colors.cyan('(') + format(instance.subject) + colors.cyan(')')) : colors.white(format(instance.subject));
});
开发者ID:beacon-studios,项目名称:chatty,代码行数:3,代码来源:index.ts
示例5: 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
示例6: info
export function info(text: string) {
if (Config.debuglevel > 3) return
console.log(cyan('info') + ' ' + text)
}
开发者ID:KewlStatics,项目名称:SocialMedia-bot,代码行数:4,代码来源:utils.ts
示例7: config
export function config(op: string, args: string[]) {
log.header('Configuration Manager');
switch (op) {
case "list": {
log.log(colors.cyan('Global'), 'options:');
var allConf = Common.iterateStringKeyObject<any>(conf.all);
allConf.forEach(v => {
if (!v.key.startsWith('repo_')) {
log.log(v.key, "=", v.value);
}
});
let repo = Common.cwdRepo();
if (!!repo) {
var lc = conf.get('repo_' + repo.name);
if (!!lc) {
log.log(colors.cyan('Local repository'), 'options:');
Common.iterateStringKeyObject<any>(lc).forEach(v => {
log.log(v.key, "=", v.value);
});
}
}
break;
}
case "set": {
if (args.length < 2) {
log.error('Not enough arguments for set operation.' +
'You must specify both key and value to set.');
return;
}
var key = args[0];
let repo = Common.cwdRepo();
if (key.startsWith('this.')) {
if (!repo) {
log.error(`You use local repository referencing (${colors.italic('this.')})` +
` while outside of any repository directory. Aborting.`);
return;
}
key = key.replace('this.', 'repo_' + repo.name + '.');
}
conf.set(key, args[1]);
log.log(args[0], '=', conf.get(key));
break;
}
case "delete": {
let repo = cwdRepo();
if (args.length < 2) {
log.error('Not enough arguments for set operation.' +
'You must specify both key and value to set.');
return;
}
var key = args[0];
if (key.startsWith('this.')) {
key = key.replace('this.', 'repo_' + repo.name + '.');
}
conf.set(key, args[1]);
log.log(args[0], '=', conf.get(key));
break;
}
default: {
log.error('unknown operation');
break;
}
}
}
开发者ID:ssyp-ru,项目名称:ssyp16-ws13,代码行数:70,代码来源:cli.ts
注:本文中的colors/safe.cyan函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论