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


TypeScript loglevel.warn函数代码示例

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


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

示例1: onChange

// error handling taken from https://webpack.github.io/docs/node.js-api.html#error-handling
function onChange(err, stats, livereloadServer, onChangeSuccess?) {
  if (err) {
    // "hard" error
    return error(err);
  }

  if (stats.hasErrors()) {
    // "soft" error
    return error(stats.toString(statsStringifierOptions));
  }

  if (stats.hasWarnings()) {
    warn(stats.toString(statsStringifierOptions));
  }

  // filter changes for live reloading
  const changedModules = stats.compilation.modules.filter(module => module.built && module.resource);
  const changedStyleModules = changedModules.filter(module => module.resource.match(/\.(css|less|sass)$/));
  let hasOnlyStyleChanges = changedModules.length === changedStyleModules.length;
  if (hasOnlyStyleChanges) {
    livereloadServer.refresh('style.css');
  } else {
    livereloadServer.refresh('index.html');
  }

  if (onChangeSuccess) {
    onChangeSuccess(stats);
  }
}
开发者ID:Mercateo,项目名称:typedocs,代码行数:30,代码来源:index.ts

示例2: onBuild

// error handling taken from https://webpack.github.io/docs/node.js-api.html#error-handling
function onBuild(
  resolve: any,
  reject: any,
  err: any,
  stats: compiler.Stats,
  watcher?: any
) {
  if (err) {
    // "hard" error
    return reject(err);
  }

  if (stats.hasErrors()) {
    // "soft" error
    return reject(stringifyStats(stats));
  }

  if (stats.hasWarnings()) {
    warn(stringifyStats(stats));
  }

  if (isVerbose()) {
    info(stringifyStats(stats));
  }

  // note: watcher is optional
  resolve(watcher);
}
开发者ID:otbe,项目名称:ws,代码行数:29,代码来源:compiler.ts

示例3: function

  Meteor.publish(GAME_SUBSCRIPTION_NAME, function (options:GameSubscriptionOptions) {
    if (!this.userId) {
      log.warn('Subscription denied due to no userId');
      return this.ready(); // Must be logged in
    }
    let gameUserIds:string[] = [];
    let handsCursor = HandCollection.find({gameId: options.gameId});
    handsCursor.forEach((game:Hand)=> {
      gameUserIds.push(game.userId);
    });
    if (gameUserIds.indexOf(this.userId)===-1) {
      let user:Meteor.User = Meteor.users.find({_id: this.userId});
      if (!AccountsAdminTools.isAdmin(user))
        return this.ready(); // Game only visible to its players or admins
    }
    let userCursor =  Meteor.users.find(
      {_id: {$in: gameUserIds}},
      {
        fields: {
          username: true,
          profile: true,
          emails: true
        }
      }
    );
    let actionCursor = GamePlayActionCollection.find({gameId: options.gameId});
//    log.debug("publish gameinfo: " + ", GameId:" + options.gameId +  ", userCount: " + userCursor.count(), ", hands count: " + handsCursor.count(), " action count:" + actionCursor.count())
    return [
      userCursor,
      handsCursor,
      actionCursor
    ];
  });
开发者ID:kokokenada,项目名称:for-real-cards,代码行数:33,代码来源:game.publications.ts

示例4:

 return Observable.forkJoin(catchedObservables).map(res => {
   if (errors.length > 0) {
     log.warn("session loading failed", errors);
     // just report the first error, this is what the forkJoin would have done by default anyway
     throw errors[0];
   } else {
     return res;
   }
 });
开发者ID:chipster,项目名称:chipster-web,代码行数:9,代码来源:session.resource.ts

示例5:

 return this.createNewTempSession().map((newSessionId: string) => {
   if (newSessionId !== null) {
     log.info("created new session", newSessionId);
     this.routeService.navigateToSession(newSessionId);
     return false;
   } else {
     log.warn("creating new session failed, going to sessions list");
     this.routeService.navigateToSessions();
     return false;
   }
 });
开发者ID:chipster,项目名称:chipster-web,代码行数:11,代码来源:analyze-guard.service.ts

示例6:

 .catch(e => {
   if (e.status === 403) {
     log.info("auth guard got 403, redirecting to login");
   } else {
     log.warn("error in auth guard, redirecting to login");
   }
   this.routeService.redirectToLoginAndBackWithCustomCurrentUrl(
     state.url
   );
   return Observable.of(false);
 });
开发者ID:chipster,项目名称:chipster-web,代码行数:11,代码来源:auth-guard.service.ts

示例7: isOldEnzyme

function isOldEnzyme() {
  const { devDependencies = {} } = project;
  const { enzyme = '' } = devDependencies;
  if (
    enzyme.startsWith('2.') ||
    enzyme.startsWith('~2.') ||
    enzyme.startsWith('^2.')
  ) {
    warn('You use an old Enzyme version. Please upgrade.');
    return true;
  } else {
    return false;
  }
}
开发者ID:Mercateo,项目名称:ws,代码行数:14,代码来源:options.ts

示例8: canActivate

 canActivate(
   route: ActivatedRouteSnapshot,
   state: RouterStateSnapshot
 ): boolean {
   const appName = route.url[0].path;
   if (appName === "chipster" || appName === "mylly") {
     this.routeService.setBackupAppName(appName);
     return true;
   } else {
     log.warn("invalid appName", appName, "redirecting to chipster home");
     this.router.navigateByUrl("/chipster/home");
     return false;
   }
 }
开发者ID:chipster,项目名称:chipster-web,代码行数:14,代码来源:app-name-guard.service.ts

示例9: handleNotifier

 return function handleNotifier() {
   switch (state) {
     case 'pending':
       child.kill();
       break;
     case 'outdated':
       info(message);
       break;
     case 'up-to-date':
       debug(message);
       break;
     case 'warn':
       warn(message);
       break;
   }
 };
开发者ID:otbe,项目名称:ws,代码行数:16,代码来源:update-notifier.ts

示例10: onBuild

// error handling taken from https://webpack.github.io/docs/node.js-api.html#error-handling
function onBuild(resolve, reject, err, stats, watcher?) {
  if (err) {
    // "hard" error
    return reject(err);
  }

  if (stats.hasErrors()) {
    // "soft" error
    return reject(stats.toString(statsStringifierOptions));
  }

  if (stats.hasWarnings()) {
    warn(stats.toString(statsStringifierOptions));
  }

  // note: watcher is optional
  resolve(watcher);
}
开发者ID:Mercateo,项目名称:typedocs,代码行数:19,代码来源:index.ts


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