Actual running flowserver on test panel LM 10.0.0.5
This commit is contained in:
commit
67c503d980
57 changed files with 16678 additions and 0 deletions
56
flow/helper/error_reporting.js
Normal file
56
flow/helper/error_reporting.js
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
const ERRWEIGHT = {
|
||||
EMERGENCY: "emergency", // System unusable
|
||||
ALERT: "alert", // Action must be taken immidiately
|
||||
CRITICAL: "critical", // Component unable to function
|
||||
ERROR: "error", // Error, but component able to recover from it
|
||||
WARNING: "warning", // Possibility of error, system running futher
|
||||
NOTICE: "notice", // Significant message but not an error, things user might want to know about
|
||||
INFO: "informational", // Info
|
||||
DEBUG: "debug" // Debug - only if CONFIG.debug is enabled
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
function sendError(func, device, weight, str, extra){
|
||||
if ((weight === ERRWEIGHT.DEBUG) && (instance.CONFIG.debug === false)){
|
||||
return; // Allow debug messages only if CONFIG.debug is active
|
||||
}
|
||||
|
||||
let content = {
|
||||
"type": weight,
|
||||
"status": "new",
|
||||
"source": {
|
||||
"func":func,
|
||||
"component":instance.id,
|
||||
"component_name":instance.name,
|
||||
"edge":myEdge
|
||||
},
|
||||
"message":str,
|
||||
"message_data": extra
|
||||
};
|
||||
let msg = {};
|
||||
msg[device] = [
|
||||
{
|
||||
"ts": Date.now(),
|
||||
"values": {
|
||||
"_event":content
|
||||
}
|
||||
}
|
||||
];
|
||||
|
||||
// Msg can be outputted from components only after configuration
|
||||
/*if (canSendErrData()){
|
||||
sendBufferedErrors();
|
||||
} else {
|
||||
bufferError(msg);
|
||||
}*/
|
||||
instance.send(0, msg); // Even if error server is unavailable, send this message to output, for other possible component connections
|
||||
|
||||
}
|
||||
|
||||
|
||||
module.exports = {
|
||||
sendError,
|
||||
ERRWEIGHT,
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue