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