diff --git a/build/gcc/makefile b/build/gcc/makefile index 6917fcf7..c2ce3148 100644 --- a/build/gcc/makefile +++ b/build/gcc/makefile @@ -17,7 +17,6 @@ OUTLIB_DEBUG = libc11log-debug.a TEST_RELEASE = testme TEST_DEBUG = testme-debug - .PHONY: all mkdirs release debug build clean all: release @@ -48,6 +47,6 @@ debug/%.o: $(SRC_DIR)/%.cpp $(CXX) -c $< -o $@ $(CXXFLAGS) clean: - rm -rf release debug $(TEST_RELEASE) $(TEST_DEBUG) $(OUTLIB_RELEASE) $(OUTLIB_DEBUG) + rm -rf release debug daily.* $(TEST_RELEASE) $(TEST_DEBUG) $(OUTLIB_RELEASE) $(OUTLIB_DEBUG) diff --git a/include/c11log/sinks/file_sinks.h b/include/c11log/sinks/file_sinks.h index 95331dd6..063d6487 100644 --- a/include/c11log/sinks/file_sinks.h +++ b/include/c11log/sinks/file_sinks.h @@ -109,15 +109,15 @@ private: /* * Thread safe file sink that closes the log file at midnight and opens new one */ -class midnight_file_sink:public base_sink { +class daily_file_sink:public base_sink { public: - midnight_file_sink(const std::string& base_filename, const std::string& extension = "txt"): + daily_file_sink(const std::string& base_filename, const std::string& extension = "txt"): _base_filename(base_filename), _extension(extension), _midnight_tp { _calc_midnight_tp() } { - _ofstream.open(_calc_filename(_base_filename, _extension)); + _ofstream.open(_calc_filename(_base_filename, _extension), std::ofstream::app); } protected: diff --git a/src/test.cpp b/src/test.cpp index 121d4afd..4ff5412b 100644 --- a/src/test.cpp +++ b/src/test.cpp @@ -16,9 +16,9 @@ int main(int argc, char* argv[]) int nthreads = argc > 1 ? atoi(argv[1]) : 1; auto null_sink = std::make_shared(); auto stdout_sink = std::make_shared(); - auto async = std::make_shared(100); + auto async = std::make_shared(1000); //auto fsink = std::make_shared("newlog", "txt", 1024*1024*10 , 2); - auto fsink = std::make_shared("midnight", "txt"); + auto fsink = std::make_shared("daily", "txt"); async->add_sink(fsink); @@ -39,7 +39,8 @@ int main(int argc, char* argv[]) }); } - while (true) + int seconds = 0; + while (seconds++ < 5) { counter = 0; std::this_thread::sleep_for(std::chrono::seconds(1));