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


TypeScript nightingale-logger.debug函數代碼示例

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


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

示例1:

 (stopEmitSubscribe: UnsubscribeEmitOnConnectCallback) => {
   _stopEmitSubscribeOnConnect = stopEmitSubscribe;
   logger.debug('subscribed', {
     resourceName: this.client.resourceName,
     key: this.key,
   });
 },
開發者ID:liwijs,項目名稱:liwi,代碼行數:7,代碼來源:ClientQuery.ts

示例2: fetch

 fetch(onFulfilled?: (value: any) => any): Promise<any> {
   logger.debug('fetch', {
     resourceName: this.client.resourceName,
     key: this.key,
   });
   return this.client
     .send('fetch', [this.key, this.params, undefined])
     .then(onFulfilled);
 }
開發者ID:liwijs,項目名稱:liwi,代碼行數:9,代碼來源:ClientQuery.ts

示例3: _subscribe

  _subscribe(callback: Callback, _includeInitial = false): SubscribeReturn {
    const eventName = `subscribe:${this.client.resourceName}.${this.key}`;
    logger.debug('subscribe', { eventName });
    const listener = (err: Error | null, result?: string) => {
      const decodedResult = result && decode(result);
      if (!PRODUCTION) logger.debug(eventName, { result, decodedResult });
      callback(err, decodedResult);
    };

    this.client.on(eventName, listener);

    let _stopEmitSubscribeOnConnect: UnsubscribeEmitOnConnectCallback;
    let promise: Promise<void> | undefined = this.client
      .emitSubscribe(_includeInitial ? 'fetchAndSubscribe' : 'subscribe', [
        this.key,
        this.params,
        eventName,
      ])
      .then(
        (stopEmitSubscribe: UnsubscribeEmitOnConnectCallback) => {
          _stopEmitSubscribeOnConnect = stopEmitSubscribe;
          logger.debug('subscribed', {
            resourceName: this.client.resourceName,
            key: this.key,
          });
        },
        (err: Error) => {
          this.client.off(eventName, listener);
          throw err;
        },
      );

    const stop = () => {
      if (!promise) return;
      promise.then(() => {
        logger.debug('unsubscribe', {
          resourceName: this.client.resourceName,
          key: this.key,
        });
        _stopEmitSubscribeOnConnect();
        this.client.send('unsubscribe', [this.key]);
        promise = undefined;
        this.client.off(eventName, listener);
      });
    };

    return {
      cancel: stop,
      stop,
      then: (cb) => Promise.resolve(promise).then(cb),
    };
  }
開發者ID:liwijs,項目名稱:liwi,代碼行數:52,代碼來源:ClientQuery.ts

示例4: send

  send(type: string, value: any[]) {
    logger.debug('emit', { type, value });
    if (this.websocket.isDisconnected()) {
      throw new Error('Websocket is not connected');
    }

    if (!this.resourceName) {
      throw new Error('Invalid resourceName');
    }

    return this.websocket
      .emit('resource', {
        type,
        resourceName: this.resourceName,
        json: encode(value),
      })
      .then((result: any) => result && decode(result));
  }
開發者ID:liwijs,項目名稱:liwi,代碼行數:18,代碼來源:WebsocketClient.ts

示例5: decode

 const listener = (err: Error | null, result?: string) => {
   const decodedResult = result && decode(result);
   if (!PRODUCTION) logger.debug(eventName, { result, decodedResult });
   callback(err, decodedResult);
 };
開發者ID:liwijs,項目名稱:liwi,代碼行數:5,代碼來源:ClientQuery.ts


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