#pragma once #include #include #include #include namespace redfish { constexpr const char* redfishEventLogFile = "/var/log/redfish"; class FilesystemLogWatcher { private: std::streampos redfishLogFilePosition{0}; int inotifyFd = -1; int dirWatchDesc = -1; int fileWatchDesc = -1; boost::asio::posix::stream_descriptor inotifyConn; void onINotify(const boost::system::error_code& ec, std::size_t bytesTransferred); void resetRedfishFilePosition(); void watchRedfishEventLogFile(); void readEventLogsFromFile(); void cacheRedfishLogFile(); std::array readBuffer{}; public: explicit FilesystemLogWatcher(boost::asio::io_context& iocIn); }; } // namespace redfish