file_event_handlers add before_open function

This commit is contained in:
seker
2021-11-13 17:19:23 +08:00
parent ff9313e6dd
commit 24a551c14e
8 changed files with 29 additions and 17 deletions

View File

@@ -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.