ListenerLogger is a little stale. The logging philosophy has changed since that was written, and now we want a log file for each data type for each system. E.g. we should have a specific log file for CdTe 1 event data, a specific file for CdTe 1 housekeeping data, a specific file for CMOS 2 quicklook data, etc. This is straightforward to implement when we receive UDP packets—check the header data for the system and data type. We can switch/case over each and choose the write log file. All that could be done in the original repository.
But, it would be easier at this point to leverage the LineInterface functionality here to infer all this stuff from systems.json and instantiate a logger. I suggest these commands to start with:
--verbose, -v (to turn on verbose mode)
--help, -h (to get help message and quit)
--use-spdlog, -s (to use spdlog-style logging, with ASCII-encoded hex rather than raw binary)
--config (to pass in systems.json for setup)
--systems (to select which systems to log data for)
What to add:
[ ] A new executable in apps/logger.cpp (requires addition to CMakeLists.txt).
[ ] A new Logger.h/Logger.cpp pair with a Logger class. Class should have fields:
class Logger {
boost::asio::io_context& context;
std::unordered_map<SystemManager, std::string> log_file_names;
std::unordered_map<SystemManager, std::shared_ptr<std::ofstream>> log_files;
std::unordered_map<SystemManager, std::shared_ptr<spdlog::logger>> spdlog_files;
bool do_verbose;
bool do_spdlog;
std::unordered_map<SystemManager, std::unordered_map<RING_BUFFER_TYPE_OPTIONS, std::vector<uint8_t>> log_queues;
int write(std::vector<uint8_t>); // should check packet header for System and data type
int write_spdlog(std::vector<uint8_t>); // and should either add to log_queue or write to file
};
The plan
ListenerLogger is a little stale. The logging philosophy has changed since that was written, and now we want a log file for each data type for each system. E.g. we should have a specific log file for CdTe 1 event data, a specific file for CdTe 1 housekeeping data, a specific file for CMOS 2 quicklook data, etc. This is straightforward to implement when we receive UDP packets—check the header data for the system and data type. We can
switch
/case
over each and choose the write log file. All that could be done in the original repository.But, it would be easier at this point to leverage the
LineInterface
functionality here to infer all this stuff fromsystems.json
and instantiate a logger. I suggest these commands to start with:What to add:
[ ] A new Logger.h/Logger.cpp pair with a
Logger
class. Class should have fields: