Definition at line 181 of file TextFileWriter.cpp.
182{
185
186 auto now = std::chrono::system_clock::now();
187 auto time_t = std::chrono::system_clock::to_time_t(now);
188
189 std::ostringstream oss;
191 << std::put_time(std::localtime(&time_t), "%Y%m%d_%H%M%S");
192
193 std::string backup_path = oss.str();
194
195 try {
196 std::filesystem::rename(
m_filepath, backup_path);
197 } catch (const std::filesystem::filesystem_error& e) {
198 m_last_error = std::string(
"Failed to rotate file: ") + e.what();
199 return false;
200 }
201
202 std::ios_base::openmode mode = std::ios_base::out | std::ios_base::trunc;
204
207 return false;
208 }
209
211 return true;
212}
References m_bytes_written, m_file, m_filepath, and m_last_error.
Referenced by write_bytes().