@gus-eip/loggers 3.5.4 → 3.5.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.
- package/dist/cloudwatch.logger.js +21 -21
- package/package.json +1 -1
@@ -31,28 +31,28 @@ let CloudWatchLoggerService = class CloudWatchLoggerService {
|
|
31
31
|
await this.cloudwatch.createLogStream(createParams).promise();
|
32
32
|
}
|
33
33
|
async logToCloudWatch(type, logObject, logStreamName) {
|
34
|
-
if (!(await this.logStreamExists(logStreamName))) {
|
35
|
-
await this.createLogStream(logStreamName);
|
36
|
-
}
|
37
|
-
const formatter = new cloudwatch_event_formatter_1.CloudWatchEventFormatter();
|
38
|
-
logObject.version = this.version;
|
39
|
-
logObject.timestamp = new Date().toISOString();
|
40
|
-
const formattedLog = formatter.formatLogItem({
|
41
|
-
meta: logObject,
|
42
|
-
...logObject,
|
43
|
-
level: type,
|
44
|
-
date: new Date(),
|
45
|
-
});
|
46
|
-
const timestampMillis = formattedLog.timestamp.getTime();
|
47
|
-
const putParams = {
|
48
|
-
logGroupName: this.logGroupName,
|
49
|
-
logStreamName: logStreamName,
|
50
|
-
logEvents: [{
|
51
|
-
message: formattedLog.message,
|
52
|
-
timestamp: timestampMillis
|
53
|
-
}],
|
54
|
-
};
|
55
34
|
try {
|
35
|
+
if (!(await this.logStreamExists(logStreamName))) {
|
36
|
+
await this.createLogStream(logStreamName);
|
37
|
+
}
|
38
|
+
const formatter = new cloudwatch_event_formatter_1.CloudWatchEventFormatter();
|
39
|
+
logObject.version = this.version;
|
40
|
+
logObject.timestamp = new Date().toISOString();
|
41
|
+
const formattedLog = formatter.formatLogItem({
|
42
|
+
meta: logObject,
|
43
|
+
...logObject,
|
44
|
+
level: type,
|
45
|
+
date: new Date(),
|
46
|
+
});
|
47
|
+
const timestampMillis = formattedLog.timestamp.getTime();
|
48
|
+
const putParams = {
|
49
|
+
logGroupName: this.logGroupName,
|
50
|
+
logStreamName: logStreamName,
|
51
|
+
logEvents: [{
|
52
|
+
message: formattedLog.message,
|
53
|
+
timestamp: timestampMillis
|
54
|
+
}],
|
55
|
+
};
|
56
56
|
await this.cloudwatch.putLogEvents(putParams).promise();
|
57
57
|
}
|
58
58
|
catch (error) {
|
package/package.json
CHANGED