mirror of
https://github.com/gabime/spdlog.git
synced 2024-12-26 02:21:34 +08:00
Fixed rotate bug
This commit is contained in:
parent
bbc6771352
commit
a9abfbb005
@ -80,6 +80,14 @@ public:
|
||||
throw spdlog_ex("Failed opening file " + fname + " for writing");
|
||||
}
|
||||
|
||||
void reopen()
|
||||
{
|
||||
if(_filename.empty())
|
||||
throw spdlog_ex("Failed re opening file - was not opened before");
|
||||
open(_filename);
|
||||
|
||||
}
|
||||
|
||||
void close()
|
||||
{
|
||||
if (_fd)
|
||||
|
@ -136,12 +136,7 @@ private:
|
||||
throw spdlog_ex("rotating_file_sink: failed renaming " + src + " to " + target);
|
||||
}
|
||||
}
|
||||
auto cur_name = _file_helper.filename();
|
||||
if (std::remove(cur_name.c_str()) != 0)
|
||||
{
|
||||
throw spdlog_ex("rotating_file_sink: failed removing " + cur_name);
|
||||
}
|
||||
_file_helper.open(cur_name);
|
||||
_file_helper.reopen();
|
||||
}
|
||||
std::string _base_filename;
|
||||
std::string _extension;
|
||||
|
Loading…
Reference in New Issue
Block a user