• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript winston.warn函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



在下文中一共展示了warn函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。

示例1: getRepository

  public async getRepository(user: string, name: string) {
    const response: request.FullResponse = await request({
      auth: {
        pass: this.token,
        sendImmediately: true,
        user: 'token'
      },
      headers: { 'User-Agent': 'CodeHub-Trending' },
      method: 'GET',
      resolveWithFullResponse: true,
      url: `https://api.github.com/repos/${user}/${name}`
    });

    const rateLimitRemaining = parseInt(response.headers['x-ratelimit-remaining'] as string, 10);
    const resetSeconds = parseInt(response.headers['x-ratelimit-reset'] as string, 10);
    const nowSeconds = Math.round(new Date().getTime() / 1000);
    const duration = resetSeconds - nowSeconds + 60;

    // We need to drop the permission object from every repository
    // because that state belongs to the user that is authenticated
    // at the curren time; which is misrepresentitive of the client
    // attempting to query this information.
    const repoBody = _.omit(JSON.parse(response.body.toString()), 'permissions');

    // Make sure we don't drain the rate limit
    if (rateLimitRemaining < 400) {
      winston.warn('Pausing for %s to allow rateLimit to reset', duration);
      await wait(duration);
    }

    return repoBody;
  }
开发者ID:thedillonb,项目名称:GitHub-Trending,代码行数:32,代码来源:github.ts


示例2: pid

    worker.on("exit", (code, signal) => {
      var replacement, lifetime = Date.now() - startTimes[pid(worker)];
      delete startTimes[pid(worker)];

      if (worker.suicide) {
        log.info("Worker", pid(worker), "terminated voluntarily.");
        return;
      }

      log.info("Process", pid(worker), "terminated with signal", signal,
                  "code", code + "; restarting.");

      if (lifetime < options.failureThreshold) {
        failures++;
      } else {
        failures = 0;
      }

      if (failures > options.retryThreshold) {
        log.warn(failures + " consecutive failures; pausing for",
                 options.retryDelay + "ms before respawning.");
      }

      setTimeout(() => {
        replacement = spawnMore();
        replacement.on("online", () =>
                       log.info("Process", replacement.process.pid,
                                "has successfully replaced", pid(worker)));
      }, (failures > options.retryThreshold) ? options.retryDelay : 0);
    });
开发者ID:FutureAdLabs,项目名称:hellojoe,代码行数:30,代码来源:hellojoe.ts


示例3: Date

 this.cache.dirtySock.on('message', (dirtyness:string) => {
   const dirtyInfo = dirtyness.split('|');
   if (dirtyInfo.length !== 2) {
     winston.warn(`${new Date()}: Got weird dirty sock data? ${dirtyness}`);
     return;
   }
   this.cache.getIdsCaches[dirtyInfo[0]] = null;
   this.cache.aggregateCaches[dirtyInfo[0]] = null;
   if ((dirtyInfo.length === 2) && this.cache.objectCache[dirtyInfo[0]]) {
     this.cache.objectCache[dirtyInfo[0]][dirtyInfo[1]] = null;
   }
 });
开发者ID:kingsquare,项目名称:communibase-connector-js,代码行数:12,代码来源:index.ts


示例4: routeNotFound

export function routeNotFound(
    req: exp.Request,
    res: exp.Response,
    next: exp.NextFunction) {

    logger.warn('route not found');

    var json = {
        code: 404,
        name: 'API Route does not exist.',
        message: 'API Route does not exist. Check the url.'
    };

    return res.status(json.code).json(json);
};
开发者ID:jokecamp,项目名称:liams-picks,代码行数:15,代码来源:index.ts


示例5: scrape

async function scrape(options: request.OptionsWithUrl): Promise<request.FullResponse> {
  while (true) {
    const result = await request({
      ...options,
      resolveWithFullResponse: true,
      simple: false
    });

    const { statusCode } = result;

    if (statusCode === 429) {
      winston.warn(`429 received (${options.url})!. Waiting 2mins.`);
      await wait(60 * 2);
      continue;
    } else if (statusCode === 200) {
      return result;
    } else {
      throw new Error(`Invalid status code: ${statusCode}`);
    }
  }
}
开发者ID:thedillonb,项目名称:GitHub-Trending,代码行数:21,代码来源:github.ts


示例6:

 .on('disconnect', (event: any) => {
     winston.warn(`Disconnected [${event.code}]: ${event.reason || 'Unknown reason'}.`)
 })
开发者ID:tinnvec,项目名称:stonebot,代码行数:3,代码来源:app.ts


示例7:

 const repos = await gh.getTrendingRepositories(time, langSlug).catch(err => {
   winston.warn(`Error trying to retrieve repositories for ${time} ${language.name}`, err);
   return [];
 });
开发者ID:thedillonb,项目名称:GitHub-Trending,代码行数:4,代码来源:main.ts



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript winston.Logger类代码示例发布时间:2022-05-25
下一篇:
TypeScript winston.verbose函数代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap