@gus-eip/loggers 3.3.7 → 3.3.8
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.
@@ -28,7 +28,6 @@ let CloudWatchLoggerService = class CloudWatchLoggerService {
|
|
28
28
|
await this.cloudwatch.createLogStream(createParams).promise();
|
29
29
|
}
|
30
30
|
async logToCloudWatch(type, logObject, logStreamName) {
|
31
|
-
const MAX_LOG_EVENT_SIZE = 262144;
|
32
31
|
if (!(await this.logStreamExists(logStreamName))) {
|
33
32
|
await this.createLogStream(logStreamName);
|
34
33
|
}
|
@@ -41,16 +40,12 @@ let CloudWatchLoggerService = class CloudWatchLoggerService {
|
|
41
40
|
level: type,
|
42
41
|
date: new Date(),
|
43
42
|
});
|
44
|
-
let logMessage = formattedLog.message;
|
45
43
|
const timestampMillis = formattedLog.timestamp.getTime();
|
46
|
-
while (Buffer.byteLength(logMessage, 'utf-8') > MAX_LOG_EVENT_SIZE) {
|
47
|
-
logMessage = logMessage.slice(0, logMessage.length - 1);
|
48
|
-
}
|
49
44
|
const putParams = {
|
50
45
|
logGroupName: this.logGroupName,
|
51
46
|
logStreamName: logStreamName,
|
52
47
|
logEvents: [{
|
53
|
-
message:
|
48
|
+
message: formattedLog.message,
|
54
49
|
timestamp: timestampMillis
|
55
50
|
}],
|
56
51
|
};
|
@@ -59,7 +54,6 @@ let CloudWatchLoggerService = class CloudWatchLoggerService {
|
|
59
54
|
}
|
60
55
|
catch (error) {
|
61
56
|
console.error('Error putting log events:', error);
|
62
|
-
throw error;
|
63
57
|
}
|
64
58
|
}
|
65
59
|
async logStreamExists(logStreamName) {
|
@@ -74,7 +68,6 @@ let CloudWatchLoggerService = class CloudWatchLoggerService {
|
|
74
68
|
}
|
75
69
|
catch (error) {
|
76
70
|
console.error('Error checking log stream:', error);
|
77
|
-
throw error;
|
78
71
|
}
|
79
72
|
}
|
80
73
|
async log(correlationId, timestamp, component, source, destination, event, usecase, sourcePayload, destinationPayload, logMessage, brand, secondaryKey, logStreamName, destinationObjectType, destinationObjectId, sourceObjectType, sourceObjectId, destinationResponse) {
|
package/package.json
CHANGED