1 #pragma once 2 3 #include <ostream> 4 #include <string_view> 5 6 namespace pixel_modem::logging { 7 8 /** 9 * @brief Data object for information about dumpings logs. 10 * 11 * @param src_dir is a const char* containing the path to the directory to be 12 copied. 13 * @param dest_dir is a const char* containing the path to the directory that 14 the contents of the source directory should be copied to. 15 * @param limit is an int of the maximum number of files to copy. 16 * @param prefix is a const char* containing a prefix that all files to be 17 copied should have. 18 */ 19 struct LogDumpInfo { 20 const std::string_view src_dir; 21 const std::string_view dest_dir; 22 int limit; 23 const std::string_view prefix; 24 25 friend bool operator==(const LogDumpInfo& lhs, const LogDumpInfo& rhs) { 26 return (lhs.limit == rhs.limit) && (lhs.src_dir == rhs.src_dir) && 27 (lhs.dest_dir == rhs.dest_dir) && (lhs.prefix == rhs.prefix); 28 } 29 30 // Do I have to use .data() here? 31 friend std::ostream& operator<<(std::ostream& os, const LogDumpInfo& obj) { 32 os << "src_dir: " << obj.src_dir << ", dest_dir: " << obj.dest_dir 33 << ", limit: " << obj.limit << ", prefix: " << obj.prefix; 34 return os; 35 } 36 }; 37 38 /** 39 * @brief Data object for information about dumpings logs. 40 * 41 * @param src_dir is a const char* containing the path to a file to be copied. 42 * @param dest_dir is a const char* containing the destination path for the file 43 * to be copied to. 44 */ 45 struct FileCopyInfo { 46 const std::string_view src_dir; 47 const std::string_view dest_dir; 48 49 friend bool operator==(const FileCopyInfo& lhs, const FileCopyInfo& rhs) { 50 return (lhs.src_dir == rhs.src_dir) && (lhs.dest_dir == rhs.dest_dir); 51 } 52 53 // Do I have to add .data() here? 54 friend std::ostream& operator<<(std::ostream& os, const FileCopyInfo& obj) { 55 os << "src_dir: " << obj.src_dir << ", dest_dir: " << obj.dest_dir; 56 return os; 57 } 58 }; 59 60 /** 61 * @brief Interface for dumping modem logs and files. 62 */ 63 class Dumper { 64 public: 65 virtual ~Dumper() = default; 66 virtual void DumpLogs(const LogDumpInfo& log_dump_info); 67 virtual void CopyFile(const FileCopyInfo& file_copy_info); 68 }; 69 70 } // namespace pixel_modem::logging 71