IO-2998 remove graylog and additional erroneous console logs.
This commit is contained in:
@@ -1,10 +1,4 @@
|
||||
const graylog2 = require("graylog2");
|
||||
const InstanceManager = require("../utils/instanceMgr").default;
|
||||
|
||||
const logger = new graylog2.graylog({
|
||||
servers: [{ host: "logs.bodyshop.app", port: 12201 }]
|
||||
});
|
||||
|
||||
const winston = require("winston");
|
||||
const WinstonCloudWatch = require("winston-cloudwatch");
|
||||
|
||||
@@ -19,28 +13,47 @@ const winstonLogger = winston.createLogger({
|
||||
//level: "debug",
|
||||
format: winston.format.json(),
|
||||
transports: [
|
||||
...(process.env.NODE_ENV !== "production" ? [new winston.transports.Console({ level: "silly" })] : []),
|
||||
new WinstonCloudWatch({
|
||||
level: "error",
|
||||
logGroupName: logGroupName,
|
||||
logStreamName: "errors",
|
||||
awsRegion: region,
|
||||
jsonMessage: true
|
||||
}),
|
||||
new WinstonCloudWatch({
|
||||
level: "warn",
|
||||
logGroupName: logGroupName,
|
||||
logStreamName: "warn",
|
||||
awsRegion: region,
|
||||
jsonMessage: true
|
||||
}),
|
||||
new WinstonCloudWatch({
|
||||
level: "debug",
|
||||
logGroupName: logGroupName,
|
||||
logStreamName: "debug",
|
||||
awsRegion: region,
|
||||
jsonMessage: true
|
||||
})
|
||||
...(process.env.NODE_ENV !== "production"
|
||||
? [
|
||||
new winston.transports.Console({
|
||||
level: "silly",
|
||||
format: winston.format.combine(
|
||||
winston.format.colorize(), // Colorize the output
|
||||
winston.format.timestamp(), // Add timestamps
|
||||
winston.format.printf(({ level, message, timestamp, user, record, object }) => {
|
||||
// Format the log message for pretty printing
|
||||
return `${timestamp} [${level}]: ${message} ${
|
||||
user ? `| user: ${JSON.stringify(user)}` : ""
|
||||
} ${record ? `| record: ${JSON.stringify(record)}` : ""} ${
|
||||
object ? `| object: ${JSON.stringify(object, null, 2)}` : ""
|
||||
}`;
|
||||
})
|
||||
)
|
||||
})
|
||||
]
|
||||
: [
|
||||
new WinstonCloudWatch({
|
||||
level: "error",
|
||||
logGroupName: logGroupName,
|
||||
logStreamName: "errors",
|
||||
awsRegion: region,
|
||||
jsonMessage: true
|
||||
}),
|
||||
new WinstonCloudWatch({
|
||||
level: "warn",
|
||||
logGroupName: logGroupName,
|
||||
logStreamName: "warn",
|
||||
awsRegion: region,
|
||||
jsonMessage: true
|
||||
}),
|
||||
new WinstonCloudWatch({
|
||||
level: "debug",
|
||||
logGroupName: logGroupName,
|
||||
logStreamName: "debug",
|
||||
awsRegion: region,
|
||||
jsonMessage: true
|
||||
})
|
||||
])
|
||||
]
|
||||
});
|
||||
|
||||
@@ -52,15 +65,9 @@ function log(message, type, user, record, object) {
|
||||
message: message,
|
||||
user: user,
|
||||
record: record,
|
||||
object: object
|
||||
meta: object
|
||||
});
|
||||
// logger.log(message, message, {
|
||||
// type,
|
||||
// env: process.env.NODE_ENV || "development",
|
||||
// user,
|
||||
// record,
|
||||
// ...object
|
||||
// });
|
||||
|
||||
}
|
||||
|
||||
module.exports = { log };
|
||||
|
||||
Reference in New Issue
Block a user