jr-common-micro 1.1.29 → 1.1.30

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -351,22 +351,31 @@ function getGrpcClient(packageName, grpcHost, grpcPort) {
351
351
  }
352
352
  function getStatus(codeSuccess, codeError, logger, data, text, logOnSuccess = false, elasticsearchService, elasticsearch_logs_index, methodName) {
353
353
  if (isEmptyAtAll(data)) {
354
+ logger.error(`getStatus function Error: ${text} `);
354
355
  if (elasticsearchService && elasticsearch_logs_index) {
355
356
  elasticsearchService.log(elasticsearch_logs_index, {
356
357
  action: 'getStatus',
357
358
  method: methodName,
358
359
  status: 'error',
359
- message: `getStatus function Error: ${text}`,
360
+ message: JSON.stringify({ text, data }),
360
361
  timestamp: new Date(),
361
362
  });
362
363
  }
363
- logger.error(`getStatus function Error: ${text} `);
364
364
  return {
365
365
  code: codeError,
366
366
  };
367
367
  }
368
368
  if (logOnSuccess) {
369
369
  logger.log(`getStatus function Success: ${text} `);
370
+ if (elasticsearchService && elasticsearch_logs_index) {
371
+ elasticsearchService.log(elasticsearch_logs_index, {
372
+ action: 'getStatus',
373
+ method: methodName,
374
+ status: 'success',
375
+ message: JSON.stringify({ text, data }),
376
+ timestamp: new Date(),
377
+ });
378
+ }
370
379
  }
371
380
  return {
372
381
  code: codeSuccess,
@@ -414,16 +423,16 @@ async function executeWithReturn(logger, logMessage, func, elasticsearchService,
414
423
  }
415
424
  catch (error) {
416
425
  logMessage.misc = { ...logMessage.misc, error };
426
+ logger.error(logMessage);
417
427
  if (elasticsearchService && elasticsearch_logs_index) {
418
428
  elasticsearchService.log(elasticsearch_logs_index, {
419
429
  action: 'executeWithReturn',
420
430
  method: methodName,
421
431
  status: 'error',
422
- message: logMessage,
432
+ message: JSON.stringify(logMessage),
423
433
  timestamp: new Date(),
424
434
  });
425
435
  }
426
- logger.error(logMessage);
427
436
  return null;
428
437
  }
429
438
  }
@@ -434,16 +443,16 @@ async function executeWithoutReturn(logger, logMessage, func, elasticsearchServi
434
443
  }
435
444
  catch (error) {
436
445
  logMessage.misc = { ...logMessage.misc, error };
446
+ logger.error(logMessage);
437
447
  if (elasticsearchService && elasticsearch_logs_index) {
438
448
  elasticsearchService.log(elasticsearch_logs_index, {
439
449
  action: 'executeWithoutReturn',
440
450
  method: methodName,
441
451
  status: 'error',
442
- message: logMessage,
452
+ message: JSON.stringify(logMessage),
443
453
  timestamp: new Date(),
444
454
  });
445
455
  }
446
- logger.error(logMessage);
447
456
  return null;
448
457
  }
449
458
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jr-common-micro",
3
- "version": "1.1.29",
3
+ "version": "1.1.30",
4
4
  "description": "",
5
5
  "author": "",
6
6
  "private": false,