From ff068f14b9e83709f9805e9b9d6add592aa22b7b Mon Sep 17 00:00:00 2001 From: aaaakshat <33050725+aaaakshat@users.noreply.github.com> Date: Sun, 6 Feb 2022 13:43:39 -0500 Subject: [PATCH] Update logger with skeleton --- src/logger/logger.cpp | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 src/logger/logger.cpp diff --git a/src/logger/logger.cpp b/src/logger/logger.cpp new file mode 100644 index 0000000..53967fb --- /dev/null +++ b/src/logger/logger.cpp @@ -0,0 +1,28 @@ +// Serial logger class + +// Standard defines +#include +#include +#include +#include + +// Ros defines +#include "ros/ros.h" + +using namespace std; + +class Logger { + // function that writes buf to out_file. + // !0 == failure; 0 == success + int append_to_file(uint8_t *buf, char *out_file); + + // returns formatted filename with prefix and current time. + // e.g. g_start_time = 12 Feb 13:01, prefix = "buffer_output", extension = ".txt" + // returns : "buffer_output_12_Feb_13:01.txt" + // Code will figure out if extension has a "." in it + char *file_name_from_time(time_t *current_time, char *prefix, char *extension); + + void log(char *msg, int ros_code); + + char *parse_packet(uint8_t *buf); +};