Browse Source

Adding log messages

master
GabrielTrettel 3 years ago
parent
commit
eab2c05e70
  1. 2
      src/App.js
  2. 2
      src/app/hooks/useFiltering.js
  3. 4
      src/app/hooks/useSocketMarkers.js

2
src/App.js

@ -43,7 +43,7 @@ export default function App() {
} }
}, [pluviometerStation]); }, [pluviometerStation]);
console.log(pluviometerStation);
// console.log(pluviometerStation);
const restoreUser = async () => { const restoreUser = async () => {
const storageUser = await authStorage.getUser(); const storageUser = await authStorage.getUser();

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(2, "days").format("YYYY-MM-DDTHH:mm:ss"); const finalDate = moment().subtract(2, "days").format("YYYY-MM-DDTHH:mm:ss");
//console.log(initialDate + "/" + finalDate);
console.log(`Criando sockets do useFiltering: ${moment().format('DD/MM, h:mm:ss:SSS')}`);
const filters = [ const filters = [
{ {

4
src/app/hooks/useSocketMarkers.js

@ -2,6 +2,7 @@ import { useState, useEffect, useReducer, useContext } from "react";
import assets from "../config/assets"; import assets from "../config/assets";
import PinIntransitavel from "../assets/floodZonesAssets/PinIntransitavel"; import PinIntransitavel from "../assets/floodZonesAssets/PinIntransitavel";
import PinTransitavel from "../assets/floodZonesAssets/PinTransitavel"; import PinTransitavel from "../assets/floodZonesAssets/PinTransitavel";
import moment from "moment";
const custom_assets = { const custom_assets = {
pluviometer: assets.pluviometer, pluviometer: assets.pluviometer,
@ -170,6 +171,7 @@ function getFormsAnswers(socketObject, dispatch) {
}; };
socketObject.socketUrl.onmessage = ({ data }) => { socketObject.socketUrl.onmessage = ({ data }) => {
console.log(`\t ====== Recebendo dados: ${socketObject.name} => ${moment().format('DD/MM, h:mm:ss:SSS')}`);
setSocketResponse(data); setSocketResponse(data);
}; };
}; };
@ -179,7 +181,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("===== Runing interval " + socketObject.name + " ========" + timerCounter);
console.log(`========> Deletando e criando sockets: ${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