@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.
- package/dist/cloudwatch.logger.js +21 -9
- package/package.json +1 -1
@@ -153,15 +153,25 @@ let CloudWatchLoggerService = class CloudWatchLoggerService {
|
|
153
153
|
status,
|
154
154
|
};
|
155
155
|
const sqsUrl = await ssm_utils_1.ssmUtils.getSqsUrl();
|
156
|
-
|
157
|
-
|
158
|
-
|
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
|
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