add max files for rotating days

This commit is contained in:
weiy 2020-01-19 13:52:01 +08:00
parent 46fcd2e844
commit 34cc3419fa

View File

@ -105,14 +105,15 @@ protected:
private: private:
void init_filenames_q() void init_filenames_q()
{ {
using details::os::file_exists; using details::os::path_exists;
filenames_q_ = details::circular_q<filename_t>(static_cast<size_t>(max_files_)); filenames_q_ = details::circular_q<filename_t>(static_cast<size_t>(max_files_));
std::vector<filename_t> filenames; std::vector<filename_t> filenames;
auto now = log_clock::now(); auto now = log_clock::now();
while (filenames.size() < max_files_) while (filenames.size() < max_files_)
{ {
auto filename = FileNameCalc::calc_filename(base_filename_, now_tm(now)); auto filename = FileNameCalc::calc_filename(base_filename_, now_tm(now));
if (!file_exists(filename)) if (!path_exists(filename))
{ {
break; break;
} }