@gus-eip/loggers 4.2.8 → 4.2.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/README.md +92 -92
- package/dist/cloudwatch.logger.js +112 -35
- package/dist/test.d.ts +2 -0
- package/dist/test.js +168 -0
- package/package.json +79 -79
package/README.md
CHANGED
|
@@ -1,92 +1,92 @@
|
|
|
1
|
-
# @gus-eip/loggers
|
|
2
|
-
|
|
3
|
-
## Overview
|
|
4
|
-
|
|
5
|
-
`@gus-eip/loggers` is a package designed to provide logging functionality for your Node.js applications. It offers integration with various logging services, including CloudWatchLogger.
|
|
6
|
-
|
|
7
|
-
## Installation
|
|
8
|
-
|
|
9
|
-
You can install the package via npm:
|
|
10
|
-
|
|
11
|
-
```bash
|
|
12
|
-
npm install @gus-eip/loggers
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
## Usage
|
|
16
|
-
|
|
17
|
-
To use the logger module in your application, follow these steps:
|
|
18
|
-
|
|
19
|
-
1. Import `LoggerModule` from `@gus-eip/loggers` inside your module.
|
|
20
|
-
|
|
21
|
-
```javascript
|
|
22
|
-
import { LoggerModule } from '@gus-eip/loggers';
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
2. Configure `LoggerModule` in your module by calling the `forRoot` method.
|
|
26
|
-
|
|
27
|
-
```javascript
|
|
28
|
-
LoggerModule.forRoot({
|
|
29
|
-
region: process.env.REGION,
|
|
30
|
-
logGroupName: process.env.LOGGER_LOG_GROUP_NAME,
|
|
31
|
-
options: 'CloudWatchLogger',
|
|
32
|
-
}),
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
Ensure you provide the necessary environment variables (`REGION` and `LOGGER_LOG_GROUP_NAME`) for configuration.
|
|
36
|
-
|
|
37
|
-
## Configuration Options
|
|
38
|
-
|
|
39
|
-
- `region`: The AWS region where your CloudWatch logs are located.
|
|
40
|
-
- `logGroupName`: The name of the log group where logs will be sent.
|
|
41
|
-
- `options`: The options for the logger. Currently, only `'CloudWatchLogger'` is supported.
|
|
42
|
-
|
|
43
|
-
## Example
|
|
44
|
-
|
|
45
|
-
```javascript
|
|
46
|
-
import { Module } from '@nestjs/common';
|
|
47
|
-
import { LoggerModule } from '@gus-eip/loggers';
|
|
48
|
-
|
|
49
|
-
@Module({
|
|
50
|
-
imports: [
|
|
51
|
-
LoggerModule.forRoot({
|
|
52
|
-
region: process.env.REGION,
|
|
53
|
-
logGroupName: process.env.LOGGER_LOG_GROUP_NAME,
|
|
54
|
-
options: 'CloudWatchLogger',
|
|
55
|
-
}),
|
|
56
|
-
],
|
|
57
|
-
})
|
|
58
|
-
export class AppModule {}
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
```
|
|
62
|
-
This repository requires AWS SSM Parameter Store access to retrieve the SQS URL dynamically. Ensure that the application has permission to read LOGGER_SQS_URL.
|
|
63
|
-
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
## License
|
|
67
|
-
|
|
68
|
-
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
69
|
-
|
|
70
|
-
---
|
|
71
|
-
|
|
72
|
-
## OAP-EIP LOGGER
|
|
73
|
-
|
|
74
|
-
Whenever any EIP integration (for example: `oap-handlers`, `oap-backend`, `eip-integration-handlers`, `platform-events-listener`, or `gus-middleware-service`) introduces a new use case, event, or component, follow these steps to keep this package as the single source of truth for EIP logging:
|
|
75
|
-
|
|
76
|
-
1. Add the new use case, event and component identifiers to `enum.ts`.
|
|
77
|
-
|
|
78
|
-
2. Add a user-friendly message/label for the use case in `mappings/usecase-mapping.ts`.
|
|
79
|
-
|
|
80
|
-
3. Update `mappings/source-destination-mapping.ts` to include the use case and the corresponding brand(s) with their `source` and `destination` values. If the use case already exists and a newly onboarded brand uses it, add the brand under that existing use case entry.
|
|
81
|
-
|
|
82
|
-
Notes:
|
|
83
|
-
|
|
84
|
-
- The `mappings/source-destination-mapping.ts` file is the ultimate source of truth for EIP logger routing and should accurately reflect brand → use case → (source, destination) mappings.
|
|
85
|
-
- Keep `enum.ts` identifiers stable. Prefer adding new identifiers rather than renaming existing ones to avoid breaking downstream projects.
|
|
86
|
-
|
|
87
|
-
Publishing and downstream updates:
|
|
88
|
-
|
|
89
|
-
- After making changes, bump and publish this package.
|
|
90
|
-
- Then update the dependency version used by the `gus-eip-analytics` repository: set the new package version in the `dev` branch for development deployments and in the `prod` branch for production deployments so downstream services pick up the release.
|
|
91
|
-
|
|
92
|
-
---
|
|
1
|
+
# @gus-eip/loggers
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
`@gus-eip/loggers` is a package designed to provide logging functionality for your Node.js applications. It offers integration with various logging services, including CloudWatchLogger.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
You can install the package via npm:
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npm install @gus-eip/loggers
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Usage
|
|
16
|
+
|
|
17
|
+
To use the logger module in your application, follow these steps:
|
|
18
|
+
|
|
19
|
+
1. Import `LoggerModule` from `@gus-eip/loggers` inside your module.
|
|
20
|
+
|
|
21
|
+
```javascript
|
|
22
|
+
import { LoggerModule } from '@gus-eip/loggers';
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
2. Configure `LoggerModule` in your module by calling the `forRoot` method.
|
|
26
|
+
|
|
27
|
+
```javascript
|
|
28
|
+
LoggerModule.forRoot({
|
|
29
|
+
region: process.env.REGION,
|
|
30
|
+
logGroupName: process.env.LOGGER_LOG_GROUP_NAME,
|
|
31
|
+
options: 'CloudWatchLogger',
|
|
32
|
+
}),
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Ensure you provide the necessary environment variables (`REGION` and `LOGGER_LOG_GROUP_NAME`) for configuration.
|
|
36
|
+
|
|
37
|
+
## Configuration Options
|
|
38
|
+
|
|
39
|
+
- `region`: The AWS region where your CloudWatch logs are located.
|
|
40
|
+
- `logGroupName`: The name of the log group where logs will be sent.
|
|
41
|
+
- `options`: The options for the logger. Currently, only `'CloudWatchLogger'` is supported.
|
|
42
|
+
|
|
43
|
+
## Example
|
|
44
|
+
|
|
45
|
+
```javascript
|
|
46
|
+
import { Module } from '@nestjs/common';
|
|
47
|
+
import { LoggerModule } from '@gus-eip/loggers';
|
|
48
|
+
|
|
49
|
+
@Module({
|
|
50
|
+
imports: [
|
|
51
|
+
LoggerModule.forRoot({
|
|
52
|
+
region: process.env.REGION,
|
|
53
|
+
logGroupName: process.env.LOGGER_LOG_GROUP_NAME,
|
|
54
|
+
options: 'CloudWatchLogger',
|
|
55
|
+
}),
|
|
56
|
+
],
|
|
57
|
+
})
|
|
58
|
+
export class AppModule {}
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
```
|
|
62
|
+
This repository requires AWS SSM Parameter Store access to retrieve the SQS URL dynamically. Ensure that the application has permission to read LOGGER_SQS_URL.
|
|
63
|
+
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## License
|
|
67
|
+
|
|
68
|
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
## OAP-EIP LOGGER
|
|
73
|
+
|
|
74
|
+
Whenever any EIP integration (for example: `oap-handlers`, `oap-backend`, `eip-integration-handlers`, `platform-events-listener`, or `gus-middleware-service`) introduces a new use case, event, or component, follow these steps to keep this package as the single source of truth for EIP logging:
|
|
75
|
+
|
|
76
|
+
1. Add the new use case, event and component identifiers to `enum.ts`.
|
|
77
|
+
|
|
78
|
+
2. Add a user-friendly message/label for the use case in `mappings/usecase-mapping.ts`.
|
|
79
|
+
|
|
80
|
+
3. Update `mappings/source-destination-mapping.ts` to include the use case and the corresponding brand(s) with their `source` and `destination` values. If the use case already exists and a newly onboarded brand uses it, add the brand under that existing use case entry.
|
|
81
|
+
|
|
82
|
+
Notes:
|
|
83
|
+
|
|
84
|
+
- The `mappings/source-destination-mapping.ts` file is the ultimate source of truth for EIP logger routing and should accurately reflect brand → use case → (source, destination) mappings.
|
|
85
|
+
- Keep `enum.ts` identifiers stable. Prefer adding new identifiers rather than renaming existing ones to avoid breaking downstream projects.
|
|
86
|
+
|
|
87
|
+
Publishing and downstream updates:
|
|
88
|
+
|
|
89
|
+
- After making changes, bump and publish this package.
|
|
90
|
+
- Then update the dependency version used by the `gus-eip-analytics` repository: set the new package version in the `dev` branch for development deployments and in the `prod` branch for production deployments so downstream services pick up the release.
|
|
91
|
+
|
|
92
|
+
---
|
|
@@ -152,7 +152,9 @@ let CloudWatchLoggerService = class CloudWatchLoggerService {
|
|
|
152
152
|
entityKey: fullLogObject.entityKey || '',
|
|
153
153
|
event: fullLogObject.event || '',
|
|
154
154
|
status,
|
|
155
|
-
message: type === 'error'
|
|
155
|
+
message: type === 'error'
|
|
156
|
+
? fullLogObject.errorMessage
|
|
157
|
+
: fullLogObject.logMessage,
|
|
156
158
|
logGroupName: this.logGroupName,
|
|
157
159
|
};
|
|
158
160
|
const sqsUrl = await ssm_utils_1.ssmUtils.getSqsUrl();
|
|
@@ -177,7 +179,7 @@ let CloudWatchLoggerService = class CloudWatchLoggerService {
|
|
|
177
179
|
}
|
|
178
180
|
}
|
|
179
181
|
async sendNotificationtoTeams(title, summary, handler, logStreamName, isFormattingRequired = true, type) {
|
|
180
|
-
console.log('Notification
|
|
182
|
+
console.log('Notification Summary : ', summary);
|
|
181
183
|
const webhookUrl = this.teamWebhookUrl;
|
|
182
184
|
const timestamp = new Date().toISOString();
|
|
183
185
|
let headers;
|
|
@@ -199,40 +201,115 @@ let CloudWatchLoggerService = class CloudWatchLoggerService {
|
|
|
199
201
|
: typeof summary === 'object'
|
|
200
202
|
? JSON.stringify(summary)
|
|
201
203
|
: summary;
|
|
202
|
-
const
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
204
|
+
const awsLogUrl = `https://eu-west-1.console.aws.amazon.com/cloudwatch/home?region=eu-west-1#logsV2:log-groups/log-group/${this.logGroupName}/log-events/${logStreamName}`;
|
|
205
|
+
const isPowerAutomate = webhookUrl.includes('powerautomate');
|
|
206
|
+
console.log('isPowerAutomate', isPowerAutomate);
|
|
207
|
+
const alertMessage = isPowerAutomate
|
|
208
|
+
? {
|
|
209
|
+
attachments: [
|
|
210
|
+
{
|
|
211
|
+
contentType: 'application/vnd.microsoft.card.adaptive',
|
|
212
|
+
content: {
|
|
213
|
+
type: 'AdaptiveCard',
|
|
214
|
+
version: '1.4',
|
|
215
|
+
body: [
|
|
216
|
+
{
|
|
217
|
+
type: 'TextBlock',
|
|
218
|
+
text: `🚨 ${title} 🚨`,
|
|
219
|
+
weight: 'Bolder',
|
|
220
|
+
size: 'Large',
|
|
221
|
+
color: type === 'Error'
|
|
222
|
+
? 'Attention'
|
|
223
|
+
: type === 'Warning'
|
|
224
|
+
? 'Warning'
|
|
225
|
+
: 'Good',
|
|
226
|
+
},
|
|
227
|
+
{
|
|
228
|
+
type: 'TextBlock',
|
|
229
|
+
text: `Handler: ${handler}`,
|
|
230
|
+
wrap: true,
|
|
231
|
+
},
|
|
232
|
+
{
|
|
233
|
+
type: 'TextBlock',
|
|
234
|
+
text: `Timestamp: ${timestamp}`,
|
|
235
|
+
wrap: true,
|
|
236
|
+
},
|
|
237
|
+
{
|
|
238
|
+
type: 'TextBlock',
|
|
239
|
+
text: `Type: ${type}`,
|
|
240
|
+
wrap: true,
|
|
241
|
+
},
|
|
242
|
+
{
|
|
243
|
+
type: 'Container',
|
|
244
|
+
items: summary.map((item) => ({
|
|
245
|
+
type: 'Container',
|
|
246
|
+
items: Object.entries(item).map(([key, value]) => ({
|
|
247
|
+
type: 'ColumnSet',
|
|
248
|
+
columns: [
|
|
249
|
+
{
|
|
250
|
+
type: 'Column',
|
|
251
|
+
width: 'auto',
|
|
252
|
+
items: [
|
|
253
|
+
{
|
|
254
|
+
type: 'TextBlock',
|
|
255
|
+
text: key,
|
|
256
|
+
weight: 'Bolder',
|
|
257
|
+
wrap: true,
|
|
258
|
+
},
|
|
259
|
+
],
|
|
260
|
+
},
|
|
261
|
+
{
|
|
262
|
+
type: 'Column',
|
|
263
|
+
width: 'stretch',
|
|
264
|
+
items: [
|
|
265
|
+
{
|
|
266
|
+
type: 'TextBlock',
|
|
267
|
+
text: typeof value === 'object'
|
|
268
|
+
? JSON.stringify(value, null, 2)
|
|
269
|
+
: String(value !== null && value !== void 0 ? value : ''),
|
|
270
|
+
wrap: true,
|
|
271
|
+
},
|
|
272
|
+
],
|
|
273
|
+
},
|
|
274
|
+
],
|
|
275
|
+
})),
|
|
276
|
+
separator: true,
|
|
277
|
+
})),
|
|
278
|
+
},
|
|
279
|
+
],
|
|
280
|
+
actions: [
|
|
281
|
+
{
|
|
282
|
+
type: 'Action.OpenUrl',
|
|
283
|
+
title: '🔍 View AWS Logs',
|
|
284
|
+
url: awsLogUrl,
|
|
285
|
+
},
|
|
286
|
+
],
|
|
230
287
|
},
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
288
|
+
},
|
|
289
|
+
],
|
|
290
|
+
}
|
|
291
|
+
: {
|
|
292
|
+
'@type': 'MessageCard',
|
|
293
|
+
'@context': 'http://schema.org/extensions',
|
|
294
|
+
summary: 'System Alert',
|
|
295
|
+
themeColor: 'FF0000',
|
|
296
|
+
title: `🚨 ${title} 🚨`,
|
|
297
|
+
sections: [
|
|
298
|
+
{
|
|
299
|
+
facts: [
|
|
300
|
+
{ name: 'summary:', value: summaryMsg },
|
|
301
|
+
{ name: 'component:', value: handler },
|
|
302
|
+
{ name: 'timestamp:', value: timestamp },
|
|
303
|
+
{ name: 'type:', value: type },
|
|
304
|
+
{
|
|
305
|
+
name: '',
|
|
306
|
+
value: `[Click here for more details](${awsLogUrl})`,
|
|
307
|
+
},
|
|
308
|
+
],
|
|
309
|
+
markdown: true,
|
|
310
|
+
},
|
|
311
|
+
],
|
|
312
|
+
};
|
|
236
313
|
try {
|
|
237
314
|
await axios_1.default.post(webhookUrl, alertMessage, {
|
|
238
315
|
headers: {
|
package/dist/test.d.ts
ADDED
package/dist/test.js
ADDED
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
const axios = require('axios');
|
|
2
|
+
async function sendNotificationtoTeams(title, summary, handler, logStreamName, isFormattingRequired = true, type) {
|
|
3
|
+
console.log('Notification summary', summary);
|
|
4
|
+
const webhookUrl = 'https://gus.webhook.office.com/webhookb2/a7847242-acac-4b2e-9d64-a3818681a2ec@5665ee7a-3634-4975-9c21-2778cda48edd/IncomingWebhook/6b32fef8240843359b1b3e902fb4d716/e06d3c50-7be6-44a2-87e7-48a4696d8297/V26sOW3X1erzRoeQSKP8rq1toiHD1Qtr41icu1ZxSHyh01';
|
|
5
|
+
const timestamp = new Date().toISOString();
|
|
6
|
+
let headers;
|
|
7
|
+
let headerRow;
|
|
8
|
+
let separatorRow;
|
|
9
|
+
let rows;
|
|
10
|
+
let formattedSummary;
|
|
11
|
+
if (isFormattingRequired) {
|
|
12
|
+
headers = Object.keys(summary[0]);
|
|
13
|
+
headerRow = `| ${headers.join(' | ')} |`;
|
|
14
|
+
separatorRow = `| ${headers.map(() => '---').join(' | ')} |`;
|
|
15
|
+
rows = summary
|
|
16
|
+
.map((item) => `| ${headers.map((header) => item[header] || '').join(' | ')} |`)
|
|
17
|
+
.join('\n');
|
|
18
|
+
formattedSummary = [headerRow, separatorRow, rows].join('\n');
|
|
19
|
+
}
|
|
20
|
+
const summaryMsg = isFormattingRequired
|
|
21
|
+
? formattedSummary
|
|
22
|
+
: typeof summary === 'object'
|
|
23
|
+
? JSON.stringify(summary)
|
|
24
|
+
: summary;
|
|
25
|
+
const awsLogUrl = `https://eu-west-1.console.aws.amazon.com/cloudwatch/home?region=eu-west-1#logsV2:log-groups/log-group/${this.logGroupName}/log-events/${logStreamName}`;
|
|
26
|
+
const isPowerAutomate = webhookUrl.includes('powerautomate');
|
|
27
|
+
const alertMessage = isPowerAutomate
|
|
28
|
+
? {
|
|
29
|
+
attachments: [
|
|
30
|
+
{
|
|
31
|
+
contentType: 'application/vnd.microsoft.card.adaptive',
|
|
32
|
+
content: {
|
|
33
|
+
type: 'AdaptiveCard',
|
|
34
|
+
version: '1.4',
|
|
35
|
+
body: [
|
|
36
|
+
{
|
|
37
|
+
type: 'TextBlock',
|
|
38
|
+
text: `🚨 ${title} 🚨`,
|
|
39
|
+
weight: 'Bolder',
|
|
40
|
+
size: 'Large',
|
|
41
|
+
color: type === 'Error'
|
|
42
|
+
? 'Attention'
|
|
43
|
+
: type === 'Warning'
|
|
44
|
+
? 'Warning'
|
|
45
|
+
: 'Good',
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
type: 'TextBlock',
|
|
49
|
+
text: `Handler: ${handler}`,
|
|
50
|
+
wrap: true,
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
type: 'TextBlock',
|
|
54
|
+
text: `Timestamp: ${timestamp}`,
|
|
55
|
+
wrap: true,
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
type: 'TextBlock',
|
|
59
|
+
text: `Type: ${type}`,
|
|
60
|
+
wrap: true,
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
type: 'Container',
|
|
64
|
+
items: summary.map((item) => ({
|
|
65
|
+
type: 'Container',
|
|
66
|
+
items: Object.entries(item).map(([key, value]) => ({
|
|
67
|
+
type: 'ColumnSet',
|
|
68
|
+
columns: [
|
|
69
|
+
{
|
|
70
|
+
type: 'Column',
|
|
71
|
+
width: 'auto',
|
|
72
|
+
items: [
|
|
73
|
+
{
|
|
74
|
+
type: 'TextBlock',
|
|
75
|
+
text: key,
|
|
76
|
+
weight: 'Bolder',
|
|
77
|
+
wrap: true,
|
|
78
|
+
},
|
|
79
|
+
],
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
type: 'Column',
|
|
83
|
+
width: 'stretch',
|
|
84
|
+
items: [
|
|
85
|
+
{
|
|
86
|
+
type: 'TextBlock',
|
|
87
|
+
text: typeof value === 'object'
|
|
88
|
+
? JSON.stringify(value, null, 2)
|
|
89
|
+
: String(value !== null && value !== void 0 ? value : ''),
|
|
90
|
+
wrap: true,
|
|
91
|
+
},
|
|
92
|
+
],
|
|
93
|
+
},
|
|
94
|
+
],
|
|
95
|
+
})),
|
|
96
|
+
separator: true,
|
|
97
|
+
})),
|
|
98
|
+
},
|
|
99
|
+
],
|
|
100
|
+
actions: [
|
|
101
|
+
{
|
|
102
|
+
type: 'Action.OpenUrl',
|
|
103
|
+
title: '🔍 View AWS Logs',
|
|
104
|
+
url: awsLogUrl,
|
|
105
|
+
},
|
|
106
|
+
],
|
|
107
|
+
},
|
|
108
|
+
},
|
|
109
|
+
],
|
|
110
|
+
}
|
|
111
|
+
: {
|
|
112
|
+
'@type': 'MessageCard',
|
|
113
|
+
'@context': 'http://schema.org/extensions',
|
|
114
|
+
summary: 'System Alert',
|
|
115
|
+
themeColor: type === 'Error'
|
|
116
|
+
? 'FF0000'
|
|
117
|
+
: type === 'Warning'
|
|
118
|
+
? 'FFFF00'
|
|
119
|
+
: '00FF00',
|
|
120
|
+
title: `🚨 ${title} 🚨`,
|
|
121
|
+
sections: [
|
|
122
|
+
{
|
|
123
|
+
facts: [
|
|
124
|
+
{ name: 'summary:', value: summaryMsg },
|
|
125
|
+
{ name: 'component:', value: handler },
|
|
126
|
+
{ name: 'timestamp:', value: timestamp },
|
|
127
|
+
{ name: 'type:', value: type },
|
|
128
|
+
{
|
|
129
|
+
name: '',
|
|
130
|
+
value: `[Click here for more details](${awsLogUrl})`,
|
|
131
|
+
},
|
|
132
|
+
],
|
|
133
|
+
markdown: true,
|
|
134
|
+
},
|
|
135
|
+
],
|
|
136
|
+
};
|
|
137
|
+
try {
|
|
138
|
+
await axios.post(webhookUrl, alertMessage, {
|
|
139
|
+
headers: {
|
|
140
|
+
'Content-Type': 'application/json',
|
|
141
|
+
},
|
|
142
|
+
});
|
|
143
|
+
console.log('Message sent successfully');
|
|
144
|
+
}
|
|
145
|
+
catch (error) {
|
|
146
|
+
console.error('Error sending message:', error);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
(async () => {
|
|
150
|
+
await sendNotificationtoTeams('Test Alert', [
|
|
151
|
+
{
|
|
152
|
+
job: 'gus-dlq-alert-job',
|
|
153
|
+
runStatus: 'Started',
|
|
154
|
+
ErrorsCount: 0,
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
job: 'kyb-kyc-event-listener',
|
|
158
|
+
totalhrsRun: 24,
|
|
159
|
+
listenerErrorsCount: 0,
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
job: 'kyb-kyc-verification-process',
|
|
163
|
+
screeningEnquiryCount: 0,
|
|
164
|
+
screeningEnquiryFeedbackCount: 0,
|
|
165
|
+
sfErrorsCount: 0,
|
|
166
|
+
},
|
|
167
|
+
], 'ZoomToBoxSyncHandler', 'TestStream123', true, 'Error');
|
|
168
|
+
})();
|
package/package.json
CHANGED
|
@@ -1,79 +1,79 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@gus-eip/loggers",
|
|
3
|
-
"version": "4.2.
|
|
4
|
-
"description": "@gus-eip/loggers is a package designed to provide logging functionality for your Node.js applications.",
|
|
5
|
-
"author": "gus",
|
|
6
|
-
"readmeFilename": "README.md",
|
|
7
|
-
"main": "dist/index.js",
|
|
8
|
-
"files": [
|
|
9
|
-
"dist/**/*",
|
|
10
|
-
"*.md"
|
|
11
|
-
],
|
|
12
|
-
"scripts": {
|
|
13
|
-
"start:dev": "tsc -w",
|
|
14
|
-
"build": "tsc",
|
|
15
|
-
"prepare": "npm run build",
|
|
16
|
-
"format": "prettier --write \"src/**/*.ts\"",
|
|
17
|
-
"lint": "tslint -p tsconfig.json -c tslint.json",
|
|
18
|
-
"test": "node --experimental-vm-modules ./node_modules/.bin/jest",
|
|
19
|
-
"test:watch": "jest --watch",
|
|
20
|
-
"test:cov": "jest --coverage",
|
|
21
|
-
"test:e2e": "jest --config ./test/jest-e2e.json"
|
|
22
|
-
},
|
|
23
|
-
"keywords": [
|
|
24
|
-
"nestjs",
|
|
25
|
-
"nodejs",
|
|
26
|
-
"javascript",
|
|
27
|
-
"typescript",
|
|
28
|
-
"eip-loggers"
|
|
29
|
-
],
|
|
30
|
-
"publishConfig": {
|
|
31
|
-
"access": "public"
|
|
32
|
-
},
|
|
33
|
-
"dependencies": {
|
|
34
|
-
"@aws-sdk/client-ssm": "^3.759.0",
|
|
35
|
-
"aws-sdk": "^2.1590.0",
|
|
36
|
-
"axios": "^1.7.4"
|
|
37
|
-
},
|
|
38
|
-
"devDependencies": {
|
|
39
|
-
"@nestjs/common": "^10.0.2",
|
|
40
|
-
"@nestjs/core": "^10.0.2",
|
|
41
|
-
"@nestjs/platform-express": "^10.0.2",
|
|
42
|
-
"@nestjs/testing": "10.0.2",
|
|
43
|
-
"@types/express": "4.17.17",
|
|
44
|
-
"@types/jest": "29.5.2",
|
|
45
|
-
"@types/lodash": "^4.17.7",
|
|
46
|
-
"@types/node": "20.3.1",
|
|
47
|
-
"@types/supertest": "2.0.12",
|
|
48
|
-
"@typescript-eslint/eslint-plugin": "^5.60.0",
|
|
49
|
-
"@typescript-eslint/parser": "^5.60.0",
|
|
50
|
-
"eslint": "^8.43.0",
|
|
51
|
-
"eslint-config-prettier": "^8.8.0",
|
|
52
|
-
"eslint-plugin-prettier": "^4.2.1",
|
|
53
|
-
"jest": "29.5.0",
|
|
54
|
-
"prettier": "2.8.8",
|
|
55
|
-
"reflect-metadata": "^0.1.13",
|
|
56
|
-
"rxjs": "^7.8.1",
|
|
57
|
-
"supertest": "6.3.3",
|
|
58
|
-
"ts-jest": "29.1.0",
|
|
59
|
-
"ts-node": "10.9.1",
|
|
60
|
-
"tsc-watch": "6.0.4",
|
|
61
|
-
"tsconfig-paths": "4.2.0",
|
|
62
|
-
"tslint": "5.20.1",
|
|
63
|
-
"typescript": "^5.5.4"
|
|
64
|
-
},
|
|
65
|
-
"jest": {
|
|
66
|
-
"moduleFileExtensions": [
|
|
67
|
-
"js",
|
|
68
|
-
"json",
|
|
69
|
-
"ts"
|
|
70
|
-
],
|
|
71
|
-
"rootDir": "src",
|
|
72
|
-
"testRegex": ".spec.ts$",
|
|
73
|
-
"transform": {
|
|
74
|
-
"^.+\\.(t|j)s$": "ts-jest"
|
|
75
|
-
},
|
|
76
|
-
"coverageDirectory": "../coverage",
|
|
77
|
-
"testEnvironment": "node"
|
|
78
|
-
}
|
|
79
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@gus-eip/loggers",
|
|
3
|
+
"version": "4.2.9",
|
|
4
|
+
"description": "@gus-eip/loggers is a package designed to provide logging functionality for your Node.js applications.",
|
|
5
|
+
"author": "gus",
|
|
6
|
+
"readmeFilename": "README.md",
|
|
7
|
+
"main": "dist/index.js",
|
|
8
|
+
"files": [
|
|
9
|
+
"dist/**/*",
|
|
10
|
+
"*.md"
|
|
11
|
+
],
|
|
12
|
+
"scripts": {
|
|
13
|
+
"start:dev": "tsc -w",
|
|
14
|
+
"build": "tsc",
|
|
15
|
+
"prepare": "npm run build",
|
|
16
|
+
"format": "prettier --write \"src/**/*.ts\"",
|
|
17
|
+
"lint": "tslint -p tsconfig.json -c tslint.json",
|
|
18
|
+
"test": "node --experimental-vm-modules ./node_modules/.bin/jest",
|
|
19
|
+
"test:watch": "jest --watch",
|
|
20
|
+
"test:cov": "jest --coverage",
|
|
21
|
+
"test:e2e": "jest --config ./test/jest-e2e.json"
|
|
22
|
+
},
|
|
23
|
+
"keywords": [
|
|
24
|
+
"nestjs",
|
|
25
|
+
"nodejs",
|
|
26
|
+
"javascript",
|
|
27
|
+
"typescript",
|
|
28
|
+
"eip-loggers"
|
|
29
|
+
],
|
|
30
|
+
"publishConfig": {
|
|
31
|
+
"access": "public"
|
|
32
|
+
},
|
|
33
|
+
"dependencies": {
|
|
34
|
+
"@aws-sdk/client-ssm": "^3.759.0",
|
|
35
|
+
"aws-sdk": "^2.1590.0",
|
|
36
|
+
"axios": "^1.7.4"
|
|
37
|
+
},
|
|
38
|
+
"devDependencies": {
|
|
39
|
+
"@nestjs/common": "^10.0.2",
|
|
40
|
+
"@nestjs/core": "^10.0.2",
|
|
41
|
+
"@nestjs/platform-express": "^10.0.2",
|
|
42
|
+
"@nestjs/testing": "10.0.2",
|
|
43
|
+
"@types/express": "4.17.17",
|
|
44
|
+
"@types/jest": "29.5.2",
|
|
45
|
+
"@types/lodash": "^4.17.7",
|
|
46
|
+
"@types/node": "20.3.1",
|
|
47
|
+
"@types/supertest": "2.0.12",
|
|
48
|
+
"@typescript-eslint/eslint-plugin": "^5.60.0",
|
|
49
|
+
"@typescript-eslint/parser": "^5.60.0",
|
|
50
|
+
"eslint": "^8.43.0",
|
|
51
|
+
"eslint-config-prettier": "^8.8.0",
|
|
52
|
+
"eslint-plugin-prettier": "^4.2.1",
|
|
53
|
+
"jest": "29.5.0",
|
|
54
|
+
"prettier": "2.8.8",
|
|
55
|
+
"reflect-metadata": "^0.1.13",
|
|
56
|
+
"rxjs": "^7.8.1",
|
|
57
|
+
"supertest": "6.3.3",
|
|
58
|
+
"ts-jest": "29.1.0",
|
|
59
|
+
"ts-node": "10.9.1",
|
|
60
|
+
"tsc-watch": "6.0.4",
|
|
61
|
+
"tsconfig-paths": "4.2.0",
|
|
62
|
+
"tslint": "5.20.1",
|
|
63
|
+
"typescript": "^5.5.4"
|
|
64
|
+
},
|
|
65
|
+
"jest": {
|
|
66
|
+
"moduleFileExtensions": [
|
|
67
|
+
"js",
|
|
68
|
+
"json",
|
|
69
|
+
"ts"
|
|
70
|
+
],
|
|
71
|
+
"rootDir": "src",
|
|
72
|
+
"testRegex": ".spec.ts$",
|
|
73
|
+
"transform": {
|
|
74
|
+
"^.+\\.(t|j)s$": "ts-jest"
|
|
75
|
+
},
|
|
76
|
+
"coverageDirectory": "../coverage",
|
|
77
|
+
"testEnvironment": "node"
|
|
78
|
+
}
|
|
79
|
+
}
|