parent
c53b7a8afc
commit
6706ab2809
|
|
@ -1,8 +1,8 @@
|
||||||
{
|
{
|
||||||
"convective": [
|
"convective": [
|
||||||
"https://www.spc.noaa.gov/products/outlook/day1otlk.png",
|
"https://www.spc.noaa.gov/products/outlook/day1otlk.gif",
|
||||||
"https://www.spc.noaa.gov/products/outlook/day2otlk.png",
|
"https://www.spc.noaa.gov/products/outlook/day2otlk.gif",
|
||||||
"https://www.spc.noaa.gov/products/outlook/day3otlk.png",
|
"https://www.spc.noaa.gov/products/outlook/day3otlk.gif",
|
||||||
"https://www.spc.noaa.gov/products/exper/day4-8/day4prob.gif",
|
"https://www.spc.noaa.gov/products/exper/day4-8/day4prob.gif",
|
||||||
"https://www.spc.noaa.gov/products/exper/day4-8/day5prob.gif",
|
"https://www.spc.noaa.gov/products/exper/day4-8/day5prob.gif",
|
||||||
"https://www.spc.noaa.gov/products/exper/day4-8/day6prob.gif",
|
"https://www.spc.noaa.gov/products/exper/day4-8/day6prob.gif",
|
||||||
|
|
|
||||||
13
index.js
13
index.js
|
|
@ -596,13 +596,14 @@ function connectWebSocket() {
|
||||||
// Save copy of rawData for debugging to event-logs/year/month/dat/random6charstring-unixtimestamp.json
|
// Save copy of rawData for debugging to event-logs/year/month/dat/random6charstring-unixtimestamp.json
|
||||||
const timestamp = new Date().toISOString().replace(/:/g, '-');
|
const timestamp = new Date().toISOString().replace(/:/g, '-');
|
||||||
const randomString = generateRandomString({ lower: true, upper: true, number: true }, 6);
|
const randomString = generateRandomString({ lower: true, upper: true, number: true }, 6);
|
||||||
const logDir = path.join(__dirname, "event-logs", timestamp.substring(0, 4), timestamp.substring(5, 7), timestamp.substring(8, 10));
|
if (process.env.ENABLE_EVT_LOGS) {
|
||||||
if (!fs.existsSync(logDir)) {
|
const logDir = path.join(__dirname, "event-logs", timestamp.substring(0, 4), timestamp.substring(5, 7), timestamp.substring(8, 10));
|
||||||
fs.mkdirSync(logDir, { recursive: true });
|
if (!fs.existsSync(logDir)) {
|
||||||
|
fs.mkdirSync(logDir, { recursive: true });
|
||||||
|
}
|
||||||
|
const logFile = path.join(logDir, `${randomString}-${Date.now()}.json`);
|
||||||
|
fs.writeFileSync(logFile, rawData);
|
||||||
}
|
}
|
||||||
const logFile = path.join(logDir, `${randomString}-${Date.now()}.json`);
|
|
||||||
fs.writeFileSync(logFile, rawData);
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const data = JSON.parse(rawData);
|
const data = JSON.parse(rawData);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue