Browse Source

feat: Added timestamps to log.

master
Denis Thiessen 5 months ago
parent
commit
7f26fa3b53
  1. 22
      src/core/log/SensorLogger.jsx

22
src/core/log/SensorLogger.jsx

@ -2,7 +2,12 @@ import { getState, setState } from "../../App";
export function pushToMouseLog(logElement) { export function pushToMouseLog(logElement) {
const sensorLog = getState().sensorLog; const sensorLog = getState().sensorLog;
sensorLog.mouseLog.push(logElement);
const currentTime = new Date();
const mouseLogElement = {
mouseLog: logElement,
timestamp: currentTime,
};
sensorLog.mouseLog.push(mouseLogElement);
setState({ sensorLog: sensorLog }); setState({ sensorLog: sensorLog });
} }
@ -41,14 +46,25 @@ export function pushToVisitLog(logElement) {
) { ) {
return; return;
} }
sensorLog.visitedSites.push(logElement);
const currentTime = new Date();
const visitLogElement = {
visitLog: logElement,
timestamp: currentTime,
};
sensorLog.visitedSites.push(visitLogElement);
setState({ sensorLog: sensorLog }); setState({ sensorLog: sensorLog });
} }
} }
export function pushToSonificationLog(logElement) { export function pushToSonificationLog(logElement) {
const sensorLog = getState().sensorLog; const sensorLog = getState().sensorLog;
sensorLog.playedSonifications.push(logElement);
const currentTime = new Date();
const sonificationLogElement = {
sonificationLog: logElement,
timestamp: currentTime,
};
sensorLog.playedSonifications.push(sonificationLogElement);
setState({ sensorLog: sensorLog }); setState({ sensorLog: sensorLog });
} }

Loading…
Cancel
Save