Skip to content

Commit 82121a2

Browse files
author
Abhinav Gautam
committed
warn
1 parent 2921626 commit 82121a2

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

app.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ else {
4242
);
4343
}
4444

45+
logger.on("warn", (error) => {
46+
console.log(error);
47+
});
48+
4549
logger.on("error", (error) => {
4650
console.log(error);
4751
});
@@ -61,7 +65,7 @@ pm2.launchBus(function (err, bus) {
6165
if (err) return console.error(err);
6266

6367
bus.on("log:out", function (log: logType) {
64-
if (log.process.name !== "PM2-LOGSTASH") {
68+
if (!["PM2-LOGSTASH", "LOGSTASH-SERVER"].includes(log.process.name)) {
6569
log.data = stripAnsi(log.data); // Removing Ansi Color Codes
6670
//Some times errors are logged in normal output
6771
let errorFlag = log.data.toUpperCase().indexOf("ERROR") != -1;
@@ -83,7 +87,7 @@ pm2.launchBus(function (err, bus) {
8387
});
8488

8589
bus.on("log:err", function (log: logType) {
86-
if (log.process.name !== "PM2-LOGSTASH") {
90+
if (!["PM2-LOGSTASH", "LOGSTASH-SERVER"].includes(log.process.name)) {
8791
log.data = stripAnsi(log.data); // Removing Ansi Color Codes
8892
var message = {
8993
timestamp: new Date(log.at).toISOString(),

dist/app.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,17 @@ else {
2424
rejectUnauthorized: false, //Does Not Work Without This Apparently
2525
}));
2626
}
27+
logger.on("warn", (error) => {
28+
console.log(error);
29+
});
2730
logger.on("error", (error) => {
2831
console.log(error);
2932
});
3033
pm2.launchBus(function (err, bus) {
3134
if (err)
3235
return console.error(err);
3336
bus.on("log:out", function (log) {
34-
if (log.process.name !== "PM2-LOGSTASH") {
37+
if (!["PM2-LOGSTASH", "LOGSTASH-SERVER"].includes(log.process.name)) {
3538
log.data = stripAnsi(log.data); // Removing Ansi Color Codes
3639
//Some times errors are logged in normal output
3740
let errorFlag = log.data.toUpperCase().indexOf("ERROR") != -1;
@@ -52,7 +55,7 @@ pm2.launchBus(function (err, bus) {
5255
}
5356
});
5457
bus.on("log:err", function (log) {
55-
if (log.process.name !== "PM2-LOGSTASH") {
58+
if (!["PM2-LOGSTASH", "LOGSTASH-SERVER"].includes(log.process.name)) {
5659
log.data = stripAnsi(log.data); // Removing Ansi Color Codes
5760
var message = {
5861
timestamp: new Date(log.at).toISOString(),

0 commit comments

Comments
 (0)