本文整理匯總了TypeScript中npmlog.warn函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript warn函數的具體用法?TypeScript warn怎麽用?TypeScript warn使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了warn函數的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1:
const _parseErr = (err, res) => {
if (err) {
log.warn('V8 error: ', err);
return 'V8 Error';
}
log.warn('V8 ' + res.request.href + ' Returned Status: ' + res.statusCode);
return 'Error querying the blockchain';
};
示例2:
_.map(preferences, (p) => {
if (!p.email || usedEmails[p.email]) return;
usedEmails[p.email] = true;
if (notification.creatorId == p.copayerId && !emailType.notifyDoer)
return;
if (
notification.creatorId != p.copayerId &&
!emailType.notifyOthers
)
return;
if (!_.includes(this.availableLanguages, p.language)) {
if (p.language) {
log.warn(
'Language for email "' + p.language + '" not available.'
);
}
p.language = this.defaultLanguage;
}
let unit;
if (wallet.coin != Defaults.COIN) {
unit = wallet.coin;
} else {
unit = p.unit || this.defaultUnit;
}
return {
copayerId: p.copayerId,
emailAddress: p.email,
language: p.language,
unit
};
})
示例3:
const logDeprecated = (req) => {
log.warn(
'DEPRECATED',
req.method,
req.url,
'(' + req.header('x-client-version') + ')'
);
};
示例4: catch
.catch(err => {
let errStr;
try { errStr = err.toString().substr(0, 100); } catch (e) { }
log.warn(
'An error occurred when trying to send email to ' + email.to,
errStr || err
);
return cb(err);
});
示例5: next
this._retrieve(provider, (err, res) => {
if (err) {
log.warn('Error retrieving data for ' + provider.name, err);
return next();
}
this.storage.storeFiatRate(provider.name, res, (err) => {
if (err) {
log.warn('Error storing data for ' + provider.name, err);
}
return next();
});
});
示例6: test
test('request', (t) => {
t.plan(1);
npmlog.level = 'silly';
npmlog.silly('silly prefix', 'x = %j', {foo:{bar:'baz'}});
npmlog.verbose('verbose prefix', 'x = %j', {foo:{bar:'baz'}});
npmlog.info('info prefix', 'x = %j', {foo:{bar:'baz'}});
npmlog.http('http prefix', 'x = %j', {foo:{bar:'baz'}});
npmlog.warn('warn prefix', 'x = %j', {foo:{bar:'baz'}});
npmlog.error('error prefix', 'x = %j', {foo:{bar:'baz'}});
npmlog.silent('silent prefix', 'x = %j', {foo:{bar:'baz'}});
t.deepEqual(result.join('').trim(), resultExpect.join('').trim(), 'result');
});
示例7:
_.map(preferences, (p) => {
if (!_.includes(this.availableLanguages, p.language)) {
if (p.language)
log.warn(
'Language for notifications "' +
p.language +
'" not available.'
);
p.language = this.defaultLanguage;
}
return {
copayerId: p.copayerId,
language: p.language,
unit: unit || p.unit || this.defaultUnit
};
})
示例8: icb
.then(ret => {
try {
ret = JSON.parse(ret);
// only process right responses.
if (!_.isUndefined(ret.blocks) && ret.blocks != x) {
log.info(`Ignoring response for ${x}:` + JSON.stringify(ret));
return icb();
}
result[x] = ret.feerate;
} catch (e) {
log.warn('fee error:', e);
}
return icb();
})