file_event_handlers add before_open function
This commit is contained in:
@@ -37,6 +37,10 @@ SPDLOG_INLINE void file_helper::open(const filename_t &fname, bool truncate)
|
||||
auto *mode = SPDLOG_FILENAME_T("ab");
|
||||
auto *trunc_mode = SPDLOG_FILENAME_T("wb");
|
||||
|
||||
if (event_handlers_.before_open)
|
||||
{
|
||||
event_handlers_.before_open(filename_);
|
||||
}
|
||||
for (int tries = 0; tries < open_tries_; ++tries)
|
||||
{
|
||||
// create containing folder if not exists already.
|
||||
|
||||
@@ -51,7 +51,7 @@ private:
|
||||
const unsigned int open_interval_ = 10;
|
||||
std::FILE *fd_{nullptr};
|
||||
filename_t filename_;
|
||||
file_event_handlers_t event_handlers_{nullptr, nullptr, nullptr};
|
||||
file_event_handlers_t event_handlers_;
|
||||
};
|
||||
} // namespace details
|
||||
} // namespace spdlog
|
||||
|
||||
Reference in New Issue
Block a user