當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。