Browse Source

Adding more logs and translating them to english

master
GabrielTrettel 3 years ago
parent
commit
3103620fe0
  1. 1
      src/app/components/forms/AssembleIngestionObject.js
  2. 2
      src/app/hooks/useFiltering.js
  3. 10
      src/app/hooks/useSocketMarkers.js

1
src/app/components/forms/AssembleIngestionObject.js

@ -11,6 +11,7 @@ async function AssembleIngestionObject(
time, time,
address address
) { ) {
console.log(`----> Sending data: ${code} = ${situation} => ${moment().format('DD/MM, h:mm:ss:SSS')}`)
const ingestionObject = { const ingestionObject = {
responseData: { responseData: {
array_to_json: [ array_to_json: [

2
src/app/hooks/useFiltering.js

@ -6,7 +6,7 @@ function useFiltering(location) {
const initialDate = moment().add(1, "days").format("YYYY-MM-DDTHH:mm:ss"); const initialDate = moment().add(1, "days").format("YYYY-MM-DDTHH:mm:ss");
const finalDate = moment().subtract(1, "days").format("YYYY-MM-DDTHH:mm:ss"); const finalDate = moment().subtract(1, "days").format("YYYY-MM-DDTHH:mm:ss");
console.log(`Criando sockets do useFiltering: ${moment().format('DD/MM, h:mm:ss:SSS')}`);
console.log(`Opening all sockets on useFiltering: ${moment().format('DD/MM, h:mm:ss:SSS')}`);
const filters = [ const filters = [
{ {

10
src/app/hooks/useSocketMarkers.js

@ -165,15 +165,19 @@ function getFormsAnswers(socketObject, dispatch) {
const [timerCounter, setTimer] = useState(1); const [timerCounter, setTimer] = useState(1);
const openListeners = () => { const openListeners = () => {
// console.log(`rodando forms answ ${socketObject.name}`);
socketObject.socketUrl.onerror = (e) => { socketObject.socketUrl.onerror = (e) => {
console.log(e.message); console.log(e.message);
}; };
socketObject.socketUrl.onmessage = ({ data }) => { socketObject.socketUrl.onmessage = ({ data }) => {
console.log(`\t ====== Recebendo dados: ${socketObject.name} => ${moment().format('DD/MM, h:mm:ss:SSS')}`);
console.log(`\t ====== Getting data from: ${socketObject.name} => ${moment().format('DD/MM, h:mm:ss:SSS')}`);
setSocketResponse(data); setSocketResponse(data);
}; };
socketObject.socketUrl.onclose = () => {
console.log(`\t ====== Socket closed : ${socketObject.name} => ${moment().format('DD/MM, h:mm:ss:SSS')}`);
}
}; };
openListeners(); openListeners();
@ -181,7 +185,7 @@ function getFormsAnswers(socketObject, dispatch) {
// Actually closing/opening sockets every 10min // Actually closing/opening sockets every 10min
useEffect(() => { useEffect(() => {
if (timerCounter % 10 == 0) { if (timerCounter % 10 == 0) {
console.log(`========> Deletando e criando sockets: ${socketObject.name} => ${moment().format('DD/MM, h:mm:ss:SSS')}`);
console.log(`========> Closing/Opening socket: ${socketObject.name} => ${moment().format('DD/MM, h:mm:ss:SSS')}`);
socketObject.socketUrl.close(); socketObject.socketUrl.close();
socketObject.socketUrl = new WebSocket(socketObject.url); socketObject.socketUrl = new WebSocket(socketObject.url);
openListeners(); openListeners();

Loading…
Cancel
Save