nextrans-logger 0.1.10 → 0.1.12

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/lib/index.cjs CHANGED
@@ -16,9 +16,7 @@ function formatMessage(log, env) {
16
16
  const date = newDate.getDate();
17
17
  const time = newDate.toTimeString();
18
18
  const timestamp = `${year}-${month}-${date} ${time}`;
19
- message.push(`[${(log === null || log === void 0 ? void 0 : log.timestamp) || timestamp}]`);
20
- message.push(`[${(_a = (env || 'Staging')) === null || _a === void 0 ? void 0 : _a.toUpperCase()}]`);
21
- message.push(`${log.level.toUpperCase()}:`);
19
+ message.push(`[${(log === null || log === void 0 ? void 0 : log.timestamp) || timestamp}][${(_a = (env || 'Staging')) === null || _a === void 0 ? void 0 : _a.toUpperCase()}][${log.level}]:`);
22
20
  if (typeof log === 'string') {
23
21
  message.push(log);
24
22
  }
@@ -78,7 +76,7 @@ class Logging {
78
76
  const slack = (level) => new winston_slack_webhook_transport_1.default({
79
77
  level,
80
78
  webhookUrl: this.slackWebhook,
81
- formatter: (log) => ({ text: `:sos: ${formatMessage(log, this.env)}` }),
79
+ formatter: (log) => ({ text: `:sos: ${formatMessage(log, this.env).replace(/\[31m/g, '').replace(/\[39m/g, '')}` }),
82
80
  });
83
81
  transportsData.push(slack('error'));
84
82
  }
@@ -103,7 +101,7 @@ class Logging {
103
101
  region: (_c = this.cloudwatchOption) === null || _c === void 0 ? void 0 : _c.region,
104
102
  credentials: (_d = this === null || this === void 0 ? void 0 : this.cloudwatchOption) === null || _d === void 0 ? void 0 : _d.credentials,
105
103
  },
106
- messageFormatter: (log) => this.lineFormat(log),
104
+ messageFormatter: (log) => this.lineFormat(log).replace(/\[31m/g, '').replace(/\[39m/g, ''),
107
105
  });
108
106
  };
109
107
  log.add(cloudwatch());
package/lib/index.js CHANGED
@@ -10,9 +10,7 @@ function formatMessage(log, env) {
10
10
  const date = newDate.getDate();
11
11
  const time = newDate.toTimeString();
12
12
  const timestamp = `${year}-${month}-${date} ${time}`;
13
- message.push(`[${log?.timestamp || timestamp}]`);
14
- message.push(`[${(env || 'Staging')?.toUpperCase()}]`);
15
- message.push(`${log.level.toUpperCase()}:`);
13
+ message.push(`[${log?.timestamp || timestamp}][${(env || 'Staging')?.toUpperCase()}][${log.level}]:`);
16
14
  if (typeof log === 'string') {
17
15
  message.push(log);
18
16
  }
@@ -73,7 +71,7 @@ export default class Logging {
73
71
  const slack = (level) => new SlackHook({
74
72
  level,
75
73
  webhookUrl: this.slackWebhook,
76
- formatter: (log) => ({ text: `:sos: ${formatMessage(log, this.env)}` }),
74
+ formatter: (log) => ({ text: `:sos: ${formatMessage(log, this.env).replace(/\[31m/g, '').replace(/\[39m/g, '')}` }),
77
75
  });
78
76
  transportsData.push(slack('error'));
79
77
  }
@@ -96,7 +94,7 @@ export default class Logging {
96
94
  region: this.cloudwatchOption?.region,
97
95
  credentials: this?.cloudwatchOption?.credentials,
98
96
  },
99
- messageFormatter: (log) => this.lineFormat(log),
97
+ messageFormatter: (log) => this.lineFormat(log).replace(/\[31m/g, '').replace(/\[39m/g, ''),
100
98
  });
101
99
  log.add(cloudwatch());
102
100
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nextrans-logger",
3
- "version": "0.1.10",
3
+ "version": "0.1.12",
4
4
  "description": "Logging for nextrans app service",
5
5
  "main": "lib/index.cjs",
6
6
  "module": "lib/index.js",