當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript loglevel.info函數代碼示例

本文整理匯總了TypeScript中loglevel.info函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript info函數的具體用法?TypeScript info怎麽用?TypeScript info使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了info函數的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: if

        .map(res => {
          const user = res[0];
          const askForAuths = res[1];
          const latestVersion = res[2];

          // is approval required for this authenticator
          const approvalRequired = askForAuths.indexOf(user.auth) !== -1;
          // has user already approved the terms of use
          const approved =
            user.termsVersion >= latestVersion && user.termsAccepted != null;

          if (!approvalRequired) {
            return true;
          } else if (approved) {
            log.info("terms of use accepted already");
            return true;
          } else {
            log.info(
              "terms of use must be accepted first",
              ", required for this auth:",
              approvalRequired,
              ", accpeted version:",
              user.termVersion,
              ", latest version:",
              latestVersion,
              ", accepted timestamp:",
              user.termsAccepted
            );
            this.routeService.navigateAbsolute("/terms");
            return false;
          }
        })
開發者ID:chipster,項目名稱:chipster-web,代碼行數:32,代碼來源:auth-guard.service.ts

示例2:

 .flatMap(session => {
   log.info("session copied, current state", session.state, temporary);
   if (temporary) {
     session.state = SessionState.TemporaryUnmodified;
   } else {
     session.state = SessionState.Ready;
   }
   log.info("set to", session.state);
   return this.updateSession(session);
 })
開發者ID:chipster,項目名稱:chipster-web,代碼行數:10,代碼來源:session.resource.ts

示例3:

 path => {
   if (path) {
     this.homeFile = this.routeService.basename(path);
     this.homePath = this.routeService.dirname(path) + "/";
     log.info("loading custom home page", this.homePath, this.homeFile);
   }
 },
開發者ID:chipster,項目名稱:chipster-web,代碼行數:7,代碼來源:home.component.ts

示例4: 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

示例5: watch

export default async function watch() {
  await removeAsync(project.ws.distDir);

  const port = await findAsync({
    startingPort: 35729
  });
  const livereloadServer = livereload.createServer({ port });
  const onChangeSuccess = (stats) => info(`Finished build at ${cyan(moment(stats.endTime).format('HH:mm:ss'))}.`);
  switch (project.ws.type) {
    case TYPE.NODE:
      await watchAsync(livereloadServer, nodeOptions, onChangeSuccess);
      break;
    case TYPE.SPA:
      if (project.ws.i18n) {
        await watchAsync(livereloadServer, createLocaleSpecificOptions(spaOptions, project.ws.i18n.locales[0]), onChangeSuccess);
      } else {
        await watchAsync(livereloadServer, spaOptions, onChangeSuccess);
      }
      break;
    case TYPE.BROWSER:
      if (project.ws.i18n) {
        await watchAsync(livereloadServer, createLocaleSpecificOptions(browserOptions, project.ws.i18n.locales[0]), onChangeSuccess);
      } else {
        await watchAsync(livereloadServer, browserOptions, onChangeSuccess);
      }
      break;
  }

  info('Finished initial build.');

  const middlewares = [
    livereloadMiddleware()
  ];
  await listenAsync(middlewares);
};
開發者ID:Mercateo,項目名稱:typedocs,代碼行數:35,代碼來源:watch.ts

示例6:

 (latestSession: LatestSession) => {
   // valid id from store?
   const idFromStore = latestSession.sessionId;
   if (
     idFromStore &&
     sessions.some(session => session.sessionId === idFromStore)
   ) {
     log.info("found valid latest session id from store", idFromStore);
     return Observable.of(idFromStore);
   } else {
     // valid source session id from store?
     const sourceSessionIdFromStore = latestSession.sourceSessionId;
     if (
       sourceSessionIdFromStore &&
       sessions.some(
         session => session.sessionId === sourceSessionIdFromStore
       )
     ) {
       log.info(
         "found valid source session id from store",
         sourceSessionIdFromStore
       );
       return Observable.of(sourceSessionIdFromStore);
     } else {
       // valid id from session db?
       return this.getLatestSessionFromSessionDb().mergeMap(
         (idFromSessionDb: string) => {
           if (
             idFromSessionDb !== null &&
             sessions.some(
               session => session.sessionId === idFromSessionDb
             )
           ) {
             log.info(
               "found valid latest session id from sessionDb",
               idFromSessionDb
             );
             return Observable.of(idFromSessionDb);
           } else {
             log.info("no valid latest session id in sessionDb");
             return Observable.of(null);
           }
         }
       );
     }
   }
 }
開發者ID:chipster,項目名稱:chipster-web,代碼行數:47,代碼來源:user.service.ts

示例7:

 () => {
   log.info("websocket closed");
   // if not unsubscribed
   if (this.topic) {
     // reconnect after clean close (server idle timeout)
     this.connect(listener, topic);
   }
 }
開發者ID:chipster,項目名稱:chipster-web,代碼行數:8,代碼來源:websocket.service.ts

示例8: return

 return (options) => {
   // handle global options
   setLevel(levels[options.parent.logLevel.toUpperCase()]);
   // handle specific action
   info(`run ${cyan(options.name())}...`);
   return action(options)
     .then(() => info(`finished ${cyan(options.name())} ♥`))
     .catch(handleError);
 };
開發者ID:Mercateo,項目名稱:typedocs,代碼行數:9,代碼來源:index.ts

示例9: build

export default async function build(options) {
  switch (project.ws.type) {
    case TYPE.NODE:
      await removeAsync(project.ws.distDir);
      await compileAsync(nodeOptions);
      break;
    case TYPE.SPA:
      if (options.production) {
        await removeAsync(project.ws.distReleaseDir);
        if (project.ws.i18n) {
          for (const locale of project.ws.i18n.locales) {
            info(`...for locale ${locale}.`);
            await compileAsync(createLocaleSpecificOptions(spaReleaseOptions, locale));
          }
        } else {
          await compileAsync(spaReleaseOptions);
        }
      } else {
        await removeAsync(project.ws.distDir);
        if (project.ws.i18n) {
          await compileAsync(createLocaleSpecificOptions(spaOptions, project.ws.i18n.locales[0]));
        } else {
          await compileAsync(spaOptions);
        }
      }
      break;
    case TYPE.BROWSER:
      await removeAsync(project.ws.distDir);
      if (project.ws.i18n) {
        for (const locale of project.ws.i18n.locales) {
          info(`...for locale ${locale}.`);
          await compileAsync(createLocaleSpecificOptions(browserOptions, locale));
          await compileAsync(createLocaleSpecificOptions(browserReleaseOptions, locale));
        }
        info(`...with all locales.`);
      }
      // even when we use locales, we create a default build containing *all* translations
      // users can select a locale with `window.process = { env: { LOCALE: 'en_GB' } };`, before they load
      // our component (this is mostly for users without build tools)
      await compileAsync(browserOptions);
      await compileAsync(browserReleaseOptions);
      break;
  }
};
開發者ID:Mercateo,項目名稱:typedocs,代碼行數:44,代碼來源:build.ts


注:本文中的loglevel.info函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。