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


TypeScript npmlog.debug函數代碼示例

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


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

示例1: next

 this._makeRequest(notification, (err, response) => {
   if (err) log.error(err);
   if (response) {
     log.debug('Request status: ', response.statusCode);
     log.debug('Request message: ', response.statusMessage);
     log.debug('Request body: ', response.request.body);
   }
   next();
 });
開發者ID:bitpay,項目名稱:bitcore,代碼行數:9,代碼來源:pushnotificationsservice.ts

示例2: return

          this.storage.fetchNotifications(walletId, null, fromTs, (
            err,
            notifications
          ) => {
            if (err) return next(err);
            const alreadyNotified = _.some(notifications, (n) => {
              return (
                n.type == 'NewIncomingTx' && n.data && n.data.txid == data.txid
              );
            });
            if (alreadyNotified) {
              log.debug(
                'The incoming tx ' + data.txid + ' was already notified'
              );
              return next();
            }

            const notification = Notification.create({
              type: 'NewIncomingTx',
              data: {
                txid: data.txid,
                address: out.address,
                amount: out.amount
              },
              walletId
            });

            this._storeAndBroadcastNotification(notification, next);
          });
開發者ID:bitpay,項目名稱:bitcore,代碼行數:29,代碼來源:blockchainmonitor.ts

示例3: _retrieve

  _retrieve(provider, cb) {
    log.debug('Fetching data for ' + provider.name);
    this.request.get(
      {
        url: provider.url,
        json: true
      },
      (err, res, body) => {
        if (err || !body) {
          return cb(err);
        }

        log.debug('Data for ' + provider.name + ' fetched successfully');

        if (!provider.parseFn) {
          return cb(
            new Error('No parse function for provider ' + provider.name)
          );
        }
        const rates = provider.parseFn(body);

        return cb(null, rates);
      }
    );
  }
開發者ID:matiu,項目名稱:bitcore,代碼行數:25,代碼來源:fiatrateservice.ts

示例4: _retrieve

  _retrieve(provider, coin, cb) {
    log.debug(`Fetching data for ${provider.name} / ${coin} `);
    this.request.get(
      {
        url: provider.url + coin.toUpperCase(),
        json: true
      },
      (err, res, body) => {
        if (err || !body) {
          return cb(err);
        }

        log.debug(`Data for ${provider.name} /  ${coin} fetched successfully`);

        if (!provider.parseFn) {
          return cb(
            new Error('No parse function for provider ' + provider.name)
          );
        }
        try {
          const rates = _.filter( provider.parseFn(body), (x) => fiatCodes[x.code] );
          return cb(null, rates);
        } catch (e)  {
          return cb(e);
        }
      }
    );
  }
開發者ID:bitpay,項目名稱:bitcore,代碼行數:28,代碼來源:fiatrateservice.ts

示例5: next

        this.storage.fetchAddressByCoin(coin, out.address, (
          err,
          address
        ) => {
          if (err) {
            log.error('Could not fetch addresses from the db');
            return next(err);
          }
          if (!address || address.isChange) return next();

          const walletId = address.walletId;
          log.debug(
            'Incoming tx for wallet ' +
            walletId +
            ' [' +
            out.amount +
            'sat -> ' +
            out.address +
            ']'
          );

          const fromTs = Date.now() - 24 * 3600 * 1000;
          this.storage.fetchNotifications(walletId, null, fromTs, (
            err,
            notifications
          ) => {
            if (err) return next(err);
            const alreadyNotified = _.some(notifications, (n) => {
              return (
                n.type == 'NewIncomingTx' && n.data && n.data.txid == data.txid
              );
            });
            if (alreadyNotified) {
              log.debug(
                'The incoming tx ' + data.txid + ' was already notified'
              );
              return next();
            }

            const notification = Notification.create({
              type: 'NewIncomingTx',
              data: {
                txid: data.txid,
                address: out.address,
                amount: out.amount
              },
              walletId
            });

            this._storeAndBroadcastNotification(notification, next);
          });
        });
開發者ID:bitpay,項目名稱:bitcore,代碼行數:52,代碼來源:blockchainmonitor.ts

示例6: _notifyNewBlock

  _notifyNewBlock(coin, network, hash) {
    log.debug(`New ${coin}/${network} block ${hash}`);
    const notification = Notification.create({
      type: 'NewBlock',
      walletId: network, // use network name as wallet id for global notifications
      data: {
        hash,
        coin,
        network
      }
    });

    this._storeAndBroadcastNotification(notification, () => { });
  }
開發者ID:bitpay,項目名稱:bitcore,代碼行數:14,代碼來源:blockchainmonitor.ts

示例7: cb

      (err, res, body) => {
        if (err || !body) {
          return cb(err);
        }

        log.debug('Data for ' + provider.name + ' fetched successfully');

        if (!provider.parseFn) {
          return cb(
            new Error('No parse function for provider ' + provider.name)
          );
        }
        const rates = provider.parseFn(body);

        return cb(null, rates);
      }
開發者ID:matiu,項目名稱:bitcore,代碼行數:16,代碼來源:fiatrateservice.ts

示例8: cb

      (err, res, body) => {
        if (err || !body) {
          return cb(err);
        }

        log.debug(`Data for ${provider.name} /  ${coin} fetched successfully`);

        if (!provider.parseFn) {
          return cb(
            new Error('No parse function for provider ' + provider.name)
          );
        }
        try {
          const rates = _.filter( provider.parseFn(body), (x) => fiatCodes[x.code] );
          return cb(null, rates);
        } catch (e)  {
          return cb(e);
        }
      }
開發者ID:bitpay,項目名稱:bitcore,代碼行數:19,代碼來源:fiatrateservice.ts

示例9:

      async.each(subs, (sub: any) => {
        log.debug('New tx confirmation ' + sub.txid);
        sub.isActive = false;
        this.storage.storeTxConfirmationSub(sub, (err) => {
          if (err) return cb(err);

          const notification = Notification.create({
            type: 'TxConfirmation',
            walletId: sub.walletId,
            creatorId: sub.copayerId,
            data: {
              txid: sub.txid,
              coin,
              network
              // TODO: amount
            }
          });
          this._storeAndBroadcastNotification(notification, cb);
        });
      });
開發者ID:bitpay,項目名稱:bitcore,代碼行數:20,代碼來源:blockchainmonitor.ts

示例10: setTimeout

    this.storage.fetchTxByHash(data.txid, (err, txp) => {
      if (err) {
        log.error('Could not fetch tx from the db');
        return;
      }
      if (!txp || txp.status != 'accepted') return;

      const walletId = txp.walletId;

      if (!processIt) {
        log.debug(
          'Detected broadcast ' +
          data.txid +
          ' of an accepted txp [' +
          txp.id +
          '] for wallet ' +
          walletId +
          ' [' +
          txp.amount +
          'sat ]'
        );
        return setTimeout(
          this._handleThirdPartyBroadcasts.bind(
            this,
            coin,
            network,
            data,
            true
          ),
          20 * 1000
        );
      }

      log.debug(
        'Processing accepted txp [' +
        txp.id +
        '] for wallet ' +
        walletId +
        ' [' +
        txp.amount +
        'sat ]'
      );

      txp.setBroadcasted();

      this.storage.storeTx(this.walletId, txp, (err) => {
        if (err) log.error('Could not save TX');

        const args = {
          txProposalId: txp.id,
          txid: data.txid,
          amount: txp.getTotalAmount()
        };

        const notification = Notification.create({
          type: 'NewOutgoingTxByThirdParty',
          data: args,
          walletId
        });
        this._storeAndBroadcastNotification(notification);
      });
    });
開發者ID:bitpay,項目名稱:bitcore,代碼行數:62,代碼來源:blockchainmonitor.ts


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