mirror of
https://github.com/gabime/spdlog.git
synced 2025-09-30 02:19:35 +08:00
small updates
This commit is contained in:
@@ -1,4 +1,9 @@
|
||||
#pragma once
|
||||
//
|
||||
// base sink templated over a mutex (either dummy or realy)
|
||||
// concrete implementation should only overrid the _sink_it method.
|
||||
// all locking is taken care of here so no locking needed by the implementors..
|
||||
//
|
||||
|
||||
#include<string>
|
||||
#include<mutex>
|
||||
|
@@ -86,20 +86,18 @@ private:
|
||||
|
||||
// Rotate files:
|
||||
// log.txt -> log.1.txt
|
||||
// ..
|
||||
// log.n.txt -> log.n+1.txt
|
||||
// log.1.txt -> log2.txt
|
||||
// log.2.txt -> log3.txt
|
||||
// log.3.txt -> delete
|
||||
|
||||
|
||||
void _rotate()
|
||||
{
|
||||
_file_helper.close();
|
||||
//Remove oldest file
|
||||
for (auto i = _max_files; i > 0; --i)
|
||||
{
|
||||
std::string src = _calc_filename(_base_filename, i - 1, _extension);
|
||||
std::string target = _calc_filename(_base_filename, i, _extension);
|
||||
if (i == _max_files)
|
||||
std::remove(target.c_str());
|
||||
std::rename(src.c_str(), target.c_str());
|
||||
}
|
||||
_file_helper.open(_calc_filename(_base_filename, 0, _extension));
|
||||
|
Reference in New Issue
Block a user