Skip to content

Commit 08e5dfe

Browse files
committed
v1.0.0.3 Rotate log file
1 parent 4dff91a commit 08e5dfe

File tree

4 files changed

+9
-7
lines changed

4 files changed

+9
-7
lines changed

CHANGELOG

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
1.0.0.3
2+
- Rotate log file
3+
14
1.0.0.2
25
- Fix shutdown exception
36
- Disable precompile header

src/main.cpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,6 @@
2121

2222
#include "pch.hpp"
2323

24-
#include "spdlog_include.h"
25-
#include <spdlog/async.h>
26-
#include <spdlog/sinks/basic_file_sink.h>
2724
#ifdef DEBUG
2825
#include <spdlog/sinks/stdout_color_sinks.h>
2926
#endif
@@ -63,9 +60,9 @@ int main(int argc, char* argv[])
6360
spdlog::set_default_logger(logger);
6461
spdlog::flush_on(spdlog::level::trace);
6562
#else
66-
auto async_file_logger = spdlog::basic_logger_mt<spdlog::async_factory>("async_file_logger", "./log/WebsocketProxy.log");
67-
spdlog::set_default_logger(async_file_logger);
68-
spdlog::flush_on(spdlog::level::info);
63+
auto async_sink = std::make_shared<spdlog::sinks::rotating_file_sink_mt>("./Log/WebsocketProxy.log", 524288000, 5);
64+
auto async_logger = std::make_shared<spdlog::async_logger>("async_logger", async_sink, spdlog::thread_pool(), spdlog::async_overflow_policy::overrun_oldest);
65+
spdlog::set_default_logger(async_logger);
6966
#endif
7067

7168
uint32_t server_queue_size = 1 << 24; // 16MB

src/pch.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030
#include <boost/beast/websocket.hpp>
3131
#include <boost/beast/websocket/ssl.hpp>
3232
#include "spdlog_include.h"
33+
#include <spdlog/async.h>
34+
#include <spdlog/sinks/rotating_file_sink.h>
3335
#include "slick_queue.h"
3436

3537
#if defined(_MSC_VER)

version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.0.0.2
1+
1.0.0.3

0 commit comments

Comments
 (0)