本文整理汇总了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();
});
示例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);
});
示例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);
}
);
}
示例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);
}
}
);
}
示例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);
});
});
示例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, () => { });
}
示例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);
}
示例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);
}
}
示例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);
});
});
示例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);
});
});