diff --git a/example/bench.cpp b/example/bench.cpp index 7bbaeb06..18118424 100644 --- a/example/bench.cpp +++ b/example/bench.cpp @@ -24,7 +24,7 @@ int main(int argc, char* argv[]) console->set_level(c11log::level::INFO); console->info("Starting bench with", howmany, "iterations.."); - auto bench = c11log::create("bench", "myrotating", "txt", 1024 * 1024 * 5, 3, 0); + auto bench = c11log::create("bench", "myrotating", "txt", 1024 * 1024 * 1, 3, 0); //auto bench = c11log::create("bench", "simplelog.txt", 1); //auto bench = c11log::create("bench"); diff --git a/include/c11log/sinks/base_sink.h b/include/c11log/sinks/base_sink.h index 43aa4c8a..6b8244c1 100644 --- a/include/c11log/sinks/base_sink.h +++ b/include/c11log/sinks/base_sink.h @@ -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 #include diff --git a/include/c11log/sinks/file_sinks.h b/include/c11log/sinks/file_sinks.h index a5c3b6c5..15f3e7d6 100644 --- a/include/c11log/sinks/file_sinks.h +++ b/include/c11log/sinks/file_sinks.h @@ -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));