The UartLogger class is an Electric Imp device side library to allow for writing logs on uart. This is helpful when running an Imp offline.
The UartLogger class is instantiated with a configured uart object. The class only needs the TX line.
uart <- hardware.uart12;
uart.configure(9600, 8, PARITY_NONE, 1, NO_CTSRTS);
logs <- UartLogger(uart);
Writes the supplied message to the uart and to server.log if the device is connected. The current timestamp is prepended to the message.
logs.log("test");
// Output: "2016-08-19 10:21:00 test"
Writes the supplied message to the uart and to server.error if the device is connected. The current timestamp and "[ERROR]" are prepended to the message.
logs.error("test");
// Output: "2016-08-19 10:21:00 [ERROR] test"
The UartLogger class is licensed under the MIT License