mirror of
https://gitlab.com/wgp/dougal/software.git
synced 2025-12-06 11:07:08 +00:00
Replace console output by debug functions
This commit is contained in:
@@ -5,6 +5,7 @@ const cfg = require("../lib/config");
|
||||
const { navdata } = require('../lib/db');
|
||||
const sendAlert = require("../lib/alerts");
|
||||
const headers = require('../lib/headers');
|
||||
const { ERROR, INFO, DEBUG } = require('DOUGAL_ROOT/debug')(__filename);
|
||||
|
||||
function maybeSendError(error, payload = {}) {
|
||||
const defaults = {
|
||||
@@ -100,22 +101,22 @@ for (const header of (cfg._("global.navigation.headers") || []).filter(h => h.ty
|
||||
});
|
||||
|
||||
server.on('message', (msg, rinfo) => {
|
||||
// console.log(`${header.type} :${header.port} ← ${msg.length} bytes from ${rinfo.address}:${rinfo.port}`);
|
||||
DEBUG(`${header.type} :${header.port} ← ${msg.length} bytes from ${rinfo.address}:${rinfo.port}`);
|
||||
|
||||
const navData = parseMessages(msg);
|
||||
|
||||
if (navData.payload.length) {
|
||||
navData.payload = navData.payload.reduce( (a, b) => Object.assign(a, b), {});
|
||||
delete navData.payload._type;
|
||||
// console.log("SAVE", JSON.stringify(navData, null, 4));
|
||||
// console.log("META", header.meta);
|
||||
// DEBUG("SAVE", JSON.stringify(navData, null, 4));
|
||||
// DEBUG("META", header.meta);
|
||||
navdata.save(navData, header.meta);
|
||||
}
|
||||
});
|
||||
|
||||
server.on('listening', () => {
|
||||
const address = server.address();
|
||||
console.log(`server listening ${address.address}:${address.port}`);
|
||||
INFO(`server listening ${address.address}:${address.port}`);
|
||||
});
|
||||
|
||||
server.bind(header.port);
|
||||
|
||||
Reference in New Issue
Block a user