@gus-eip/loggers 3.8.8 → 3.8.9

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.
@@ -153,15 +153,25 @@ let CloudWatchLoggerService = class CloudWatchLoggerService {
153
153
  status,
154
154
  };
155
155
  const sqsUrl = await ssm_utils_1.ssmUtils.getSqsUrl();
156
- const results = await Promise.allSettled([
157
- this.logToCloudWatch(type, fullLogObject, logStreamName),
158
- this.sendToSQS(logEvent, sqsUrl),
159
- ]);
160
- results.forEach((result, index) => {
161
- if (result.status === 'rejected') {
162
- console.error(`Error in ${index === 0 ? 'logToCloudWatch' : 'sendToSQS'}:`, result.reason);
156
+ if (status === 'IN_PROGRESS' || !sqsUrl) {
157
+ try {
158
+ await this.logToCloudWatch(type, fullLogObject, logStreamName);
163
159
  }
164
- });
160
+ catch (error) {
161
+ console.error('Error logging to CloudWatch:', error);
162
+ }
163
+ }
164
+ else {
165
+ const results = await Promise.allSettled([
166
+ this.logToCloudWatch(type, fullLogObject, logStreamName),
167
+ this.sendToSQS(logEvent, sqsUrl),
168
+ ]);
169
+ results.forEach((result, index) => {
170
+ if (result.status === 'rejected') {
171
+ console.error(`Error in ${index === 0 ? 'logToCloudWatch' : 'sendToSQS'}:`, result.reason);
172
+ }
173
+ });
174
+ }
165
175
  }
166
176
  async sendNotificationtoTeams(title, summary, handler, logStreamName, isFormattingRequired = true, type) {
167
177
  console.log('Notification summary', summary);
@@ -255,7 +265,9 @@ let CloudWatchLoggerService = class CloudWatchLoggerService {
255
265
  sourceObjectId,
256
266
  destinationResponse,
257
267
  };
258
- const status = event === this.loggerEnum.Event.OPERATION_COMPLETED ? 'COMPLETED' : 'IN_PROGRESS';
268
+ const status = event === this.loggerEnum.Event.OPERATION_COMPLETED
269
+ ? 'COMPLETED'
270
+ : 'IN_PROGRESS';
259
271
  await this.processLog('info', logStreamName, logObject, status);
260
272
  }
261
273
  async error(correlationId, timestamp, component, source, destination, event, usecase, sourcePayload, destinationPayload, errorMessage, brand, secondaryKey, logStreamName, entityKeyField, entityKey, destinationObjectType, destinationObjectId, sourceObjectType, sourceObjectId, destinationResponse) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gus-eip/loggers",
3
- "version": "3.8.8",
3
+ "version": "3.8.9",
4
4
  "description": "@gus-eip/loggers is a package designed to provide logging functionality for your Node.js applications.",
5
5
  "author": "gus",
6
6
  "readmeFilename": "README.md",