当前位置: 首页>>代码示例>>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;未经允许,请勿转载。