Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate ListenerLogger-equivalent to this repository. #43

Open
3 tasks
thanasipantazides opened this issue Oct 28, 2023 · 0 comments
Open
3 tasks

Migrate ListenerLogger-equivalent to this repository. #43

thanasipantazides opened this issue Oct 28, 2023 · 0 comments

Comments

@thanasipantazides
Copy link
Contributor

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 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
};
  • (Use async version of spdlog logger.)
@thanasipantazides thanasipantazides added this to the NSROC integration milestone Dec 19, 2023
@thanasipantazides thanasipantazides removed this from the NSROC integration milestone Jan 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant