IO-2959 Add Crisp Status Reporter to API.
This commit is contained in:
@@ -8,10 +8,10 @@ const InstanceManager = require("../utils/instanceMgr").default;
|
||||
const winston = require("winston");
|
||||
const WinstonCloudWatch = require("winston-cloudwatch");
|
||||
const { isString, isEmpty } = require("lodash");
|
||||
const { networkInterfaces, hostname } = require("node:os");
|
||||
const { uploadFileToS3 } = require("./s3");
|
||||
const { v4 } = require("uuid");
|
||||
const { InstanceRegion } = require("./instanceMgr");
|
||||
const getHostNameOrIP = require("./getHostNameOrIP");
|
||||
|
||||
const LOG_LEVELS = {
|
||||
error: { level: 0, name: "error" },
|
||||
@@ -76,22 +76,6 @@ const createLogger = () => {
|
||||
})();
|
||||
};
|
||||
|
||||
const getHostNameOrIP = () => {
|
||||
// Try to get the hostname first
|
||||
const hostName = hostname();
|
||||
if (hostName) return hostName;
|
||||
|
||||
const interfaces = networkInterfaces();
|
||||
for (const name of Object.keys(interfaces)) {
|
||||
for (const iface of interfaces[name]) {
|
||||
if (iface.family === "IPv4" && !iface.internal) {
|
||||
return iface.address;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return "127.0.0.1";
|
||||
};
|
||||
const createProductionTransport = (level, logStreamName, filters) => {
|
||||
return new WinstonCloudWatch({
|
||||
level,
|
||||
|
||||
Reference in New Issue
Block a user