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


TypeScript chalk.gray函数代码示例

本文整理汇总了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
        );
    }
}
开发者ID:zcg331793187,项目名称:DownloadYouLike,代码行数:31,代码来源:log.ts

示例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')
  })
开发者ID:nskazki,项目名称:murky,代码行数:7,代码来源:stringHandler.test.ts

示例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;
  };
开发者ID:gitter-badger,项目名称:ubiquits,代码行数:26,代码来源:consoleLogger.service.ts

示例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')}
    
`
开发者ID:sadeeqaji,项目名称:graphcool-cli,代码行数:33,代码来源:usage.ts

示例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)}]`),
 ])
开发者ID:Ahskys,项目名称:desktop,代码行数:8,代码来源:help.ts

示例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}/`)
}
开发者ID:alexsandrocruz,项目名称:botpress,代码行数:57,代码来源:bootstrap.ts

示例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('')
 })
开发者ID:mirego,项目名称:accent-cli,代码行数:9,代码来源:project-stats.ts

示例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())
     ]);
 });
开发者ID:adamfitzpatrick,项目名称:tslint-stylish,代码行数:9,代码来源:reporter.ts

示例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));
  }
}
开发者ID:socialmedialabs,项目名称:popover,代码行数:15,代码来源:release.ts


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