mirror of
https://github.com/gabime/spdlog.git
synced 2024-12-26 10:31:34 +08:00
Limit max number of rotating files to 200000. Fix #1905
This commit is contained in:
parent
53c9b70ea3
commit
4cea9b8729
@ -35,6 +35,11 @@ SPDLOG_INLINE rotating_file_sink<Mutex>::rotating_file_sink(
|
|||||||
{
|
{
|
||||||
throw_spdlog_ex("rotating sink constructor: max_size arg cannot be zero");
|
throw_spdlog_ex("rotating sink constructor: max_size arg cannot be zero");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (max_size > 200000)
|
||||||
|
{
|
||||||
|
throw_spdlog_ex("rotating sink constructor: max_size arg cannot exceed 2000000");
|
||||||
|
}
|
||||||
file_helper_.open(calc_filename(base_filename_, 0));
|
file_helper_.open(calc_filename(base_filename_, 0));
|
||||||
current_size_ = file_helper_.size(); // expensive. called only once
|
current_size_ = file_helper_.size(); // expensive. called only once
|
||||||
if (rotate_on_open && current_size_ > 0)
|
if (rotate_on_open && current_size_ > 0)
|
||||||
|
Loading…
Reference in New Issue
Block a user