mirror of
https://github.com/gabime/spdlog.git
synced 2024-11-27 07:14:12 +08:00
fix
This commit is contained in:
parent
b10cfa8180
commit
3a30e57d25
@ -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)
|
||||
|
||||
|
||||
|
@ -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:
|
||||
|
@ -16,9 +16,9 @@ int main(int argc, char* argv[])
|
||||
int nthreads = argc > 1 ? atoi(argv[1]) : 1;
|
||||
auto null_sink = std::make_shared<c11log::sinks::null_sink>();
|
||||
auto stdout_sink = std::make_shared<c11log::sinks::stdout_sink>();
|
||||
auto async = std::make_shared<c11log::sinks::async_sink>(100);
|
||||
auto async = std::make_shared<c11log::sinks::async_sink>(1000);
|
||||
//auto fsink = std::make_shared<c11log::sinks::rotating_file_sink>("newlog", "txt", 1024*1024*10 , 2);
|
||||
auto fsink = std::make_shared<c11log::sinks::midnight_file_sink>("midnight", "txt");
|
||||
auto fsink = std::make_shared<c11log::sinks::daily_file_sink>("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));
|
||||
|
Loading…
Reference in New Issue
Block a user