我正在尝试异步异步尝试捕获块几天。
async function executeJob(job) {
// necessary variable declaration code here
try {
do {
let procedureRequests = await ProcedureRequestModel.find(filter, options);
// doing process here...
} while (fetchedCount < totalCount);
providerNPIIds = [...providerNPIIds];
// Fetch provider details
let providerDetails = await esHelper.getProvidersById(providerNPIIds, true);
try {
let updateProviderCount = await UserProvider.updateAll(
{
userId: userId
},
{
providers: providerNPIIds,
countByType: providerCountType
});
if(updateProviderCount) {
try {
let destroyJobId = await app.models.Job.destroyById(job.idd);
} catch (e) {
var err = new QueueError();
console.log(err instanceof …Run Code Online (Sandbox Code Playgroud) const DATE_FORMAT = "YYYY-MM-DD";
const endDate = "2020-05-05T00:00:00.000Z" (dynamic value from service)
const appValidDate = moment(endDate).subtract(1, "days").format(DATE_FORMAT);
const currentDate = moment().startOf("day").format(DATE_FORMAT);
const validDate = moment(currentDate).isSameOrBefore(appValidDate);
Run Code Online (Sandbox Code Playgroud)
我一直在尝试使用 moment 来比较两个日期。运行应用程序时,我收到以下弃用警告。
Deprecation warning: value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are discouraged and will be removed in an upcoming major release. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.
Arguments: …Run Code Online (Sandbox Code Playgroud) 当我尝试使用 winston logger 进行日志记录时,我无法在 nodejs 中正确看到 id 和错误。
这是 logger.js 文件:
const path = require('path');
const winston = require('winston');
module.exports = function (app) {
global.logger = new Logger(app.config.get('app').logLevel);
};
function Logger(logLevel='info') {
return winston.createLogger({
levels: {alert: 0, error: 1, warn: 2, info: 3, verbose: 4, debug: 5, silly: 6},
level: logLevel,
transports: [
new (winston.transports.Console)({level: logLevel}),
new (require('winston-daily-rotate-file'))({filename: path.resolve(__dirname + '/../../logs/app.log')})
]
});
}
Run Code Online (Sandbox Code Playgroud)
在 Customer.js 中,我尝试这样记录:
logger.warn('Failed to update patient during user(%s) creation', userInstance.id, err);
Run Code Online (Sandbox Code Playgroud)
这是我得到的输出:
{"_bsontype":"ObjectID","id":{"type":"Buffer","data":[93,0,225,203,227,175,68,1,61,50,162,194]},"level":"warn","message":"Failed to update …Run Code Online (Sandbox Code Playgroud) 我正在使用 Angular 7 和 Angular Material 从 api 获取用户名。为此,我使用了角材料芯片。这是链接,我正在关注:
https://stackblitz.com/angular/jemmxnqdyro?file=app%2Fchips-autocomplete-example.ts
但问题是目前我正在从数组中获取数据。我真正需要的是从这个 api 中获取用户名:https : //jsonplaceholder.typicode.com/users。我感到困惑的是如何使用角材料芯片以及如何获取数据。
你能帮我实现同样的功能吗,因为我是 angular 的新手。
如果有人可以在这方面展示演示,那将非常有帮助。
提前致谢。
javascript ×3
node.js ×3
angular ×1
angular7 ×1
async-await ×1
datetime ×1
ecmascript-6 ×1
logging ×1
momentjs ×1
winston ×1