Skip to content

Commit d30e44d

Browse files
committed
add check and header in FileLogger2
1 parent 8cec462 commit d30e44d

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/loggers/bt_file_logger_v2.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@ FileLogger2::FileLogger2(const BT::Tree& tree, std::filesystem::path const& file
1818
//-------------------------------------
1919
file_stream_.open(filepath, std::ofstream::binary | std::ofstream::out);
2020

21+
if(!file_stream_.is_open()) {
22+
throw RuntimeError("problem opening file in FileLogger2");
23+
}
24+
25+
file_stream_ << "BTCPP4-FileLogger2";
26+
2127
std::string const xml = WriteTreeToXML(tree, true, true);
2228

2329
// serialize the length of the buffer in the first 4 bytes

0 commit comments

Comments
 (0)