@gus-eip/loggers 3.4.3 → 3.4.5
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.
@@ -10,7 +10,7 @@ export declare class CloudWatchLoggerService implements ILogger {
|
|
10
10
|
createLogStream(logStreamName: string): Promise<any>;
|
11
11
|
logToCloudWatch(type: string, logObject: any, logStreamName: string): Promise<void>;
|
12
12
|
logStreamExists(logStreamName: string): Promise<boolean>;
|
13
|
-
sendAlerttoTeams(errorMessage: any, handler: any, input: any, logStreamName: any): Promise<any>;
|
13
|
+
sendAlerttoTeams(errorMessage: any, errorStack: any, handler: any, input: any, logStreamName: any): Promise<any>;
|
14
14
|
log(correlationId: string, timestamp: string, component: string, source: string, destination: string, event: string, usecase: string, sourcePayload: any, destinationPayload: any, logMessage: any, brand: any, secondaryKey: string, logStreamName: string, destinationObjectType?: string, destinationObjectId?: string, sourceObjectType?: string, sourceObjectId?: string, destinationResponse?: any): Promise<any>;
|
15
15
|
error(correlationId: string, timestamp: string, component: string, source: string, destination: string, event: string, usecase: string, sourcePayload: any, destinationPayload: any, errorMessage: any, brand: any, secondaryKey: string, logStreamName: string, destinationObjectType?: string, destinationObjectId?: string, sourceObjectType?: string, sourceObjectId?: string, destinationResponse?: any): Promise<any>;
|
16
16
|
}
|
@@ -73,7 +73,7 @@ let CloudWatchLoggerService = class CloudWatchLoggerService {
|
|
73
73
|
console.error('Error checking log stream:', error);
|
74
74
|
}
|
75
75
|
}
|
76
|
-
async sendAlerttoTeams(errorMessage, handler, input, logStreamName) {
|
76
|
+
async sendAlerttoTeams(errorMessage, errorStack, handler, input, logStreamName) {
|
77
77
|
console.log("Error message", errorMessage);
|
78
78
|
const webhookUrl = this.teamWebhoookUrl;
|
79
79
|
const timestamp = new Date().toISOString();
|
@@ -95,6 +95,10 @@ let CloudWatchLoggerService = class CloudWatchLoggerService {
|
|
95
95
|
"name": "errorMessage:",
|
96
96
|
"value": `\`\`\`${errorMessage}\`\`\``
|
97
97
|
},
|
98
|
+
{
|
99
|
+
"name": "errorStack",
|
100
|
+
"value": `\`\`\`${errorStack}\`\`\``
|
101
|
+
},
|
98
102
|
{
|
99
103
|
"name": "component:",
|
100
104
|
"value": handler
|
@@ -169,9 +173,9 @@ let CloudWatchLoggerService = class CloudWatchLoggerService {
|
|
169
173
|
sourceObjectId,
|
170
174
|
destinationResponse
|
171
175
|
};
|
172
|
-
await this.logToCloudWatch('error', logObject,
|
176
|
+
await this.logToCloudWatch('error', logObject, logStreamName);
|
173
177
|
if (this.isAlertNeeded) {
|
174
|
-
await this.sendAlerttoTeams(errorMessage, component, logObject, logStreamName);
|
178
|
+
await this.sendAlerttoTeams(errorMessage.message ? errorMessage.message : errorMessage, errorMessage.stack ? errorMessage.stack : errorMessage, component, logObject, encodeURIComponent(logStreamName));
|
175
179
|
}
|
176
180
|
}
|
177
181
|
};
|
package/package.json
CHANGED