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


TypeScript utils.logger类代码示例

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


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

示例1: showReportDialog

  /**
   * Show a report dialog to the user to send feedback to a specific event.
   *
   * @param options Set individual options for the dialog
   */
  public showReportDialog(options: ReportDialogOptions = {}): void {
    // doesn't work without a document (React Native)
    const document = getGlobalObject<Window>().document;
    if (!document) {
      return;
    }

    if (!this._isEnabled()) {
      logger.error('Trying to call showReportDialog with Sentry Client is disabled');
      return;
    }

    const dsn = options.dsn || this.getDsn();

    if (!options.eventId) {
      logger.error('Missing `eventId` option in showReportDialog call');
      return;
    }

    if (!dsn) {
      logger.error('Missing `Dsn` option in showReportDialog call');
      return;
    }

    const script = document.createElement('script');
    script.async = true;
    script.src = new API(dsn).getReportDialogEndpoint(options);

    if (options.onLoad) {
      script.onload = options.onLoad;
    }

    (document.head || document.body).appendChild(script);
  }
开发者ID:getsentry,项目名称:raven-js,代码行数:39,代码来源:client.ts

示例2: constructor

 /** Creates a new backend instance. */
 public constructor(options: O) {
   this._options = options;
   if (!this._options.dsn) {
     logger.warn('No DSN provided, backend will not do anything.');
   }
   this._transport = this._setupTransport();
 }
开发者ID:getsentry,项目名称:raven-js,代码行数:8,代码来源:basebackend.ts

示例3: setupIntegration

export function setupIntegration(integration: Integration): void {
  if (installedIntegrations.indexOf(integration.name) !== -1) {
    return;
  }
  integration.setupOnce(addGlobalEventProcessor, getCurrentHub);
  installedIntegrations.push(integration.name);
  logger.log(`Integration installed: ${integration.name}`);
}
开发者ID:getsentry,项目名称:raven-js,代码行数:8,代码来源:integration.ts

示例4: defaultOnFatalError

export function defaultOnFatalError(error: Error): void {
  console.error(error && error.stack ? error.stack : error);
  const client = getCurrentHub().getClient<NodeClient>();

  if (client === undefined) {
    logger.warn('No NodeClient was defined, we are exiting the process now.');
    global.process.exit(1);
    return;
  }

  const options = client.getOptions();
  const timeout =
    (options && options.shutdownTimeout && options.shutdownTimeout > 0 && options.shutdownTimeout) ||
    DEFAULT_SHUTDOWN_TIMEOUT;
  forget(
    client.close(timeout).then((result: boolean) => {
      if (!result) {
        logger.warn('We reached the timeout for emptying the request buffer, still exiting now!');
      }
      global.process.exit(1);
    }),
  );
}
开发者ID:getsentry,项目名称:raven-js,代码行数:23,代码来源:handlers.ts

示例5:

 client.close(timeout).then((result: boolean) => {
   if (!result) {
     logger.warn('We reached the timeout for emptying the request buffer, still exiting now!');
   }
   global.process.exit(1);
 }),
开发者ID:getsentry,项目名称:raven-js,代码行数:6,代码来源:handlers.ts

示例6:

 this._transport.sendEvent(event).catch(reason => {
   logger.error(`Error while sending event: ${reason}`);
 });
开发者ID:getsentry,项目名称:raven-js,代码行数:3,代码来源:basebackend.ts

示例7: getCurrentHub

export function initAndBind<F extends Client, O extends Options>(clientClass: ClientClass<F, O>, options: O): void {
  if (options.debug === true) {
    logger.enable();
  }
  getCurrentHub().bindClient(new clientClass(options));
}
开发者ID:getsentry,项目名称:raven-js,代码行数:6,代码来源:sdk.ts


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