本文整理汇总了TypeScript中chalk.gray函数的典型用法代码示例。如果您正苦于以下问题:TypeScript gray函数的具体用法?TypeScript gray怎么用?TypeScript gray使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了gray函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: ilog
function ilog(ctx: any, start: any, len: any, err: any, event: any = null) {
const status = err ? (err.status || 500) : (ctx.status || 404);
let length: any;
if (~[204, 205, 304].indexOf(status)) {
length = '';
} else if (null == len) {
length = '-';
} else {
length = bytes(len);
}
const upstream = err ? chalk.red('xxx')
: event === 'close' ? chalk.yellow('-x-')
: chalk.gray('-->');
if (err) {
ctx.logger.error(
upstream, chalk.bold(ctx.method),
chalk.gray(ctx.originalUrl),
status,
time(start),
length
);
} else {
ctx.logger.info(
upstream, chalk.bold(ctx.method),
chalk.gray(ctx.originalUrl),
status,
time(start),
length
);
}
}
示例2: it
it('undefined x 2', () => {
const cRes = color('%s %s', undefined, undefined)
const nRes = nocolor('%s %s', undefined, undefined)
assert.equal(cRes, `${gray('undefined')} ${gray('undefined')}`)
assert.equal(nRes, 'undefined undefined')
})
示例3: persistLog
public persistLog(logLevel: LogLevel, messages: any[]): this {
messages = this.formatMessages(logLevel, messages);
if (this.sourceName) {
messages.unshift(gray('[' + this.format(logLevel, this.sourceName) + ']'));
}
messages.unshift( gray('[' + this.format(logLevel, moment().format('HH:mm:ss')) + '] '));
switch (logLevel) {
case 'emergency':
case 'alert':
case 'critical':
case 'error':
console.error(messages.shift(), ...messages);
break;
case 'warning':
case 'notice':
console.warn(messages.shift(), ...messages);
break;
default:
console.log(messages.shift(), ...messages);
}
return this;
};
示例4: developers
export const usageRoot = (showQuickstart: boolean) => `
Serverless GraphQL backend for frontend developers (${chalk.underline('https://www.graph.cool')})
${chalk.dim('Usage:')} ${chalk.bold('graphcool')} [command]
${chalk.dim('Commands:')}${showQuickstart ? `
quickstart Open Graphcool Quickstart examples`: ''}
init Create a new project
push Push project file changes
pull Download the latest project file
export Export project data
endpoints Print GraphQL endpoints
console Open Graphcool Console
playground Open GraphQL Playground
projects List projects
delete Delete existing projects
auth Sign up or login
version Print version
Run 'graphcool COMMAND --help' for more information on a command.
${chalk.dim('Examples:')}
${chalk.gray('-')} Initialize a new Graphcool project
${chalk.cyan('$ graphcool init')}
${chalk.gray('-')} Local setup of an existing project
${chalk.cyan('$ graphcool pull -p <project-id | alias>')}
${chalk.gray('-')} Update live project with local changes
${chalk.cyan('$ graphcool push')}
`
示例5:
.map(([optionName, option]) => [
[optionName, ...(option.aliases || [])]
.map(dasherizeOption)
.map(x => chalk.bold.blue(x))
.join(chalk.gray(', ')),
option.description,
chalk.gray(`[${chalk.underline(option.type)}]`),
])
示例6: start
async function start() {
const logger = await Logger('Launcher')
logger.info(chalk`========================================
{bold ${center(`Botpress Server`, 40)}}
{dim ${center(`Version ${sdk.version}`, 40)}}
{dim ${center(`OS ${process.distro.toString()}`, 40)}}
========================================`)
global.printErrorDefault = err => {
logger.attachError(err).error('Unhandled Rejection')
}
const modules: sdk.ModuleEntryPoint[] = []
const globalConfig = await Config.getBotpressConfig()
const loadingErrors: Error[] = []
let modulesLog = ''
const resolver = new ModuleResolver(logger)
for (const entry of globalConfig.modules) {
try {
if (!entry.enabled) {
modulesLog += os.EOL + `${chalk.dim('⊝')} ${entry.location} ${chalk.gray('(disabled)')}`
continue
}
const moduleLocation = await resolver.resolve(entry.location)
const rawEntry = resolver.requireModule(moduleLocation)
const entryPoint = ModuleLoader.processModuleEntryPoint(rawEntry, entry.location)
modules.push(entryPoint)
process.LOADED_MODULES[entryPoint.definition.name] = moduleLocation
modulesLog += os.EOL + `${chalk.greenBright('⦿')} ${entry.location}`
} catch (err) {
modulesLog += os.EOL + `${chalk.redBright('⊗')} ${entry.location} ${chalk.gray('(error)')}`
loadingErrors.push(new FatalError(err, `Fatal error loading module "${entry.location}"`))
}
}
logger.info(`Using ${chalk.bold(modules.length.toString())} modules` + modulesLog)
for (const err of loadingErrors) {
logger.attachError(err).error('Error starting Botpress')
}
if (loadingErrors.length) {
process.exit(1)
}
await Botpress.start({ modules }).catch(err => {
logger.attachError(err).error('Error starting Botpress')
process.exit(1)
})
logger.info(`Botpress is ready at http://${process.HOST}:${process.PORT}/`)
}
示例7:
this.project.documents.entries.forEach((document: Document) => {
console.log(
' ',
chalk.gray('Format:'),
chalk.white.bold(document.format)
)
console.log(' ', chalk.gray('Path:'), chalk.white.bold(document.path))
console.log('')
})
示例8:
this.ruleFailures.forEach((failure: RuleFailure) => {
// Error positions are zero-based from tslint, and must be incremented by 1
failures.push([
" ",
chalk.gray("line " + (failure.getStartPosition().line + 1)),
chalk.gray("col " + (failure.getStartPosition().character + 1)),
chalk.red(failure.getFailure())
]);
});
示例9: gitTags
async function gitTags() {
const { version } = JSON.parse(readFileSync(DIST_PACKAGE_PATH, 'utf8'));
console.log(chalk.green(`Tagging with ${version}`));
const { stdout: tag } = await exec(`git tag v${version}`);
const { stdout: push } = await exec(`git push --tags`);
if (tag) {
console.log(chalk.gray(tag));
}
if (push) {
console.log(chalk.gray(push));
}
}