Merge branch 'v1.x' of https://github.com/gabime/spdlog into std-format

This commit is contained in:
Charles Milette
2021-11-16 11:30:23 -05:00
11 changed files with 68 additions and 38 deletions

View File

@@ -20,7 +20,7 @@
namespace spdlog {
namespace details {
SPDLOG_INLINE file_helper::file_helper(const file_event_handlers_t& event_handlers)
SPDLOG_INLINE file_helper::file_helper(const file_event_handlers& event_handlers)
: event_handlers_(event_handlers)
{}
@@ -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.

View File

@@ -17,7 +17,7 @@ class SPDLOG_API file_helper
{
public:
file_helper() = default;
explicit file_helper(const file_event_handlers_t& event_handlers);
explicit file_helper(const file_event_handlers& event_handlers);
file_helper(const file_helper &) = delete;
file_helper &operator=(const file_helper &) = delete;
@@ -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 event_handlers_;
};
} // namespace details
} // namespace spdlog