how does a datalogger work