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

TypeScript loglevel.debug函数代码示例

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

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



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

示例1: queryBrowsers

export function queryBrowsers(
  query: string = project.ws.targets.browsers
): Browser[] {
  debug(`Parse browsers from query: ${query}.`);
  const browsers = browserslist(query)
    .map(browser => {
      let [name, version] = browser.split(' ');
      const hasVersionRange = version.includes('-');
      if (hasVersionRange) {
        version = version.split('-')[1];
      }
      return { name, version };
    })
    .filter(({ name }) =>
      supportedBrowsers.some(({ browserslist }) => browserslist === name)
    )
    .map(({ name, version }) => {
      const browserName = supportedBrowsers.find(
        ({ browserslist }) => browserslist === name
      )!.selenium;
      return {
        browserName,
        version,
        id: `${browserName}-${version}`
      };
    });

  debug(`Parsed browsers: ${browsers.map(({ id }) => id)}.`);
  return browsers;
}
开发者ID:otbe,项目名称:ws,代码行数:30,代码来源:get-browsers.ts


示例2: Server

 const server = new Server(karmaConfig, exitCode => {
   debug(`Karma finished.`);
   if (sauceConnectProcess) {
     debug(`Tries to close Sauce Connect.`);
     sauceConnectProcess.close(() => {
       debug(`Closed Sauce Connect.`);
       resolve(exitCode);
     });
   } else {
     resolve(exitCode);
   }
 });
开发者ID:otbe,项目名称:ws,代码行数:12,代码来源:karma.ts


示例3: importTranslation

function importTranslation(locale: string, feature: string, i18n: I18nConfig) {
  // at this place we know i18n.importUrl config is set, no need for null checks
  const url = urlTemplate.parse(i18n.importUrl!).expand({ locale, feature });
  const outputPath = join(
    process.cwd(),
    i18n.dir,
    feature,
    `${locale}.properties`
  );

  debug(`Import from ${url}.`);

  return new Promise<void>((resolve, reject) => {
    get(url, res => {
      let body = '';
      res.on('data', data => (body = body + data));
      res.on('error', err => console.log(err));
      res.on('end', () => {
        if (IGNORED_CONTENTS.some(content => body === content)) {
          resolve();
        } else {
          outputFileAsync(outputPath, body)
            .then(() => resolve())
            .catch(reject);
        }
      });
    }).on('error', reject);
  });
}
开发者ID:otbe,项目名称:ws,代码行数:29,代码来源:i18n-import.ts


示例4: readTranslation

async function readTranslation(
  cwd: string,
  dir: string,
  locale: string,
  feature: string
): Promise<Translation> {
  const readPath = join(cwd, dir, feature, `${locale}.properties`);

  debug(`Read from ${readPath}.`);

  const translation: Translation = await readFileAsync(readPath, 'utf8')
    .then(parse)
    .catch(err => {
      if (err.code === 'ENOENT') {
        // translations can be "empty"
        return {};
      } else {
        throw err;
      }
    })
    .then(camelCaseKeys)
    .then(data => ({ data, locale }));

  return translation;
}
开发者ID:otbe,项目名称:ws,代码行数:25,代码来源:get-translations.ts


示例5: testAsync

export async function testAsync(options: { grid?: boolean } = {}) {
  debug(`Configure Karma...`);
  const karmaConfig = Object.assign({}, defaultConfig, {
    basePath: process.cwd(),
    files: [
      join(project.ws.distTestsDir, project.ws.i18n ? project.ws.i18n.locales[0] : '', 'index.js')
    ],
    preprocessors: {
      [join(project.ws.distTestsDir, 'index.js')]: [ 'sourcemap' ]
    }
  });

  let sauceConnectProcess;
  if (options.grid) {
    const {
      host,
      port,
      filterForAvailability
    } = project.ws.selenium;
    const browsersQuery = project.ws.browsers;
    const browsers = filterForAvailability ? await getBrowsersFilteredByAvailability() : getBrowsers();

    if (browsers.length === 0) {
      throw `No browsers are available on ${yellow(`${host}:${port}`)} given ${yellow(browsersQuery)}.`;
    }

    const customLaunchers = browsers.reduce(toCustomLaunchersObject, {});
    Object.assign(karmaConfig, {
      hostname: getIpAddress(),
      customLaunchers,
      browsers: Object.keys(customLaunchers)
    });

    if (isSauceLabsHost(host)) {
      const {
        user: username,
        password: accessKey
      } = project.ws.selenium;
      sauceConnectProcess = await launchSauceConnect({ username, accessKey });
    }
  }

  return new Promise((resolve, reject) => {
    const server = new Server(karmaConfig, (exitCode) => {
      debug(`Karma finished.`);
      if (sauceConnectProcess) {
        debug(`Tries to close Sauce Connect.`);
        sauceConnectProcess.close(() => {
          debug(`Closed Sauce Connect.`);
          resolve(exitCode);
        });
      } else {
        resolve(exitCode);
      }
    });

    debug(`Start Karma.`);
    server.start();
  });
}
开发者ID:Mercateo,项目名称:typedocs,代码行数:60,代码来源:karma.ts


示例6: getBrowsersFilteredByAvailability

export async function getBrowsersFilteredByAvailability(browsers: string = project.ws.browsers): Promise<Browser[]> {
  const availableBrowsers = await getAvailableBrowsers();
  const availableBrowsersData = availableBrowsers
    .filter(({ browserName }) => supportedBrowsers.some(({ selenium }) => selenium === browserName))
    .reduce((data, browser) => {
      const name = supportedBrowsers.find(({ selenium }) => selenium === browser.browserName).browserslist;
      if (data[name]) {
        data[name].released.unshift(browser.version);
        data[name].versions.unshift(browser.version);
      } else {
        data[name] = {
          name,
          released: [ browser.version ],
          versions: [ browser.version ]
        };
      }
      return data;
    }, {});

  // override `browserslist.data`
  browserslist.data = availableBrowsersData;
  const browsersFilteredByAvailability = getBrowsers(browsers);
  // restore`browserslist.data`
  browserslist.data = originalData;

  debug(`Filtered available browsers: ${browsersFilteredByAvailability.map(({ id }) => id)}.`);
  return browsersFilteredByAvailability;
}
开发者ID:Mercateo,项目名称:typedocs,代码行数:28,代码来源:selenium-grid.ts


示例7: reject

 grid.available({ host, port }, (err, nodes) => {
   if (err) {
     reject(err);
   } else {
     debug(`Found ${nodes.length} nodes.`);
     resolve(nodes);
   }
 });
开发者ID:otbe,项目名称:ws,代码行数:8,代码来源:get-browsers.ts


示例8: sauceConnectLauncher

 sauceConnectLauncher(options, (err, sauceConnectProcess) => {
   if (err) {
     reject(err);
   } else {
     debug('Launched Sauce Connect.');
     resolve(sauceConnectProcess);
   }
 });
开发者ID:otbe,项目名称:ws,代码行数:8,代码来源:sauce-connect.ts


示例9: getAllAvailableBrowsers

async function getAllAvailableBrowsers(): Promise<Browser[]> {
  let browsersWithoutId: { version: string; browserName: string }[];
  if (isSauceLabsHost(project.ws.selenium!.host)) {
    debug(`Get available browsers on Sauce Labs.`);
    const platforms: any = await new Promise((resolve, reject) => {
      get(SAUCE_LABS_PLATFORMS, res => {
        let body = '';
        res.on('data', data => (body = body + data));
        res.on('end', () => resolve(JSON.parse(body)));
      }).on('error', reject);
    });
    browsersWithoutId = platforms
      .map(({ api_name, short_version }: any) => ({
        // treat 'iphone' like 'ipad' (same browser)
        browserName: api_name === 'iphone' ? 'ipad' : api_name,
        version: short_version
      }))
      // sauce labs supports beta/dev versions, but we can't map them back to browserslist
      .filter(({ version }: any) => version !== 'dev' && version !== 'beta');
  } else {
    debug(`Get available browsers on Selenium Grid.`);
    // convert status like https://github.com/davglass/selenium-grid-status#usage
    // to a list of unique browsers containing just the `browserName`, `version` and `id`
    const nodes = await getNodes();
    browsersWithoutId = flatten(nodes.map(node => node.browser)).map(
      ({ browserName, version }) => ({
        // treat 'iphone' like 'ipad' (same browser)
        browserName: browserName === 'iphone' ? 'ipad' : browserName,
        version
      })
    );
  }
  const browsersWithId: Browser[] = browsersWithoutId.map(
    ({ version, browserName }) => ({
      browserName,
      version,
      id: `${browserName}-${version}`
    })
  );
  const browsers = uniqBy(browsersWithId, 'id').sort(sortByVersion);

  debug(`Available browsers: ${browsers.map(({ id }) => id)}.`);
  return browsers;
}
开发者ID:otbe,项目名称:ws,代码行数:44,代码来源:get-browsers.ts


示例10: load

 public load(): void {
   let filePath: string = this.filePath;
   log.debug(`Loadig ${filePath}.`);
   let result: IConfig;
   if (fs.existsSync(filePath)) {
     result = JSON.parse(fs.readFileSync(filePath).toString());
   } else {
     result = {};
   }
   if (!result.recentSaveBaseDirs) result.recentSaveBaseDirs = [];
   this.$hub.config = result;
 }
开发者ID:nashika,项目名称:spreadsheet-code-generator,代码行数:12,代码来源:config.service.ts



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
TypeScript loglevel.error函数代码示例发布时间:2022-05-25
下一篇:
TypeScript FetchProvider.default函数代码示例发布时间: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