format
This commit is contained in:
parent
80f19d7136
commit
0d7a1d1ef9
@ -10,8 +10,8 @@
|
|||||||
#include <thread>
|
#include <thread>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "spdlog/spdlog.h"
|
|
||||||
#include "spdlog/sinks/simple_file_sink.h"
|
#include "spdlog/sinks/simple_file_sink.h"
|
||||||
|
#include "spdlog/spdlog.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
@ -6,8 +6,8 @@
|
|||||||
#include <chrono>
|
#include <chrono>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
#include "spdlog/spdlog.h"
|
|
||||||
#include "spdlog/sinks/simple_file_sink.h"
|
#include "spdlog/sinks/simple_file_sink.h"
|
||||||
|
#include "spdlog/spdlog.h"
|
||||||
|
|
||||||
int main(int, char *[])
|
int main(int, char *[])
|
||||||
{
|
{
|
||||||
|
@ -121,7 +121,6 @@ void async_example()
|
|||||||
}
|
}
|
||||||
// std::this_thread::sleep_for(std::chrono::seconds(1));
|
// std::this_thread::sleep_for(std::chrono::seconds(1));
|
||||||
|
|
||||||
|
|
||||||
// you can also modify thread pool settings *before* creating the logger:
|
// you can also modify thread pool settings *before* creating the logger:
|
||||||
// spdlog::init_thread_pool(32768, 4); // queue with max 32k items 4 backing threads.
|
// spdlog::init_thread_pool(32768, 4); // queue with max 32k items 4 backing threads.
|
||||||
}
|
}
|
||||||
|
@ -179,7 +179,13 @@ using filename_t = std::wstring;
|
|||||||
using filename_t = std::string;
|
using filename_t = std::string;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define SPDLOG_CATCH_AND_HANDLE \
|
||||||
#define SPDLOG_CATCH_AND_HANDLE catch (const std::exception &ex) {_err_handler(ex.what());}\
|
catch (const std::exception &ex) \
|
||||||
catch (...) {_err_handler("Unknown exeption in logger");}
|
{ \
|
||||||
|
_err_handler(ex.what()); \
|
||||||
|
} \
|
||||||
|
catch (...) \
|
||||||
|
{ \
|
||||||
|
_err_handler("Unknown exeption in logger"); \
|
||||||
|
}
|
||||||
} // namespace spdlog
|
} // namespace spdlog
|
||||||
|
@ -159,9 +159,7 @@ namespace spdlog {
|
|||||||
|
|
||||||
void worker_loop()
|
void worker_loop()
|
||||||
{
|
{
|
||||||
while (process_next_msg())
|
while (process_next_msg()) {};
|
||||||
{
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// process next message in the queue
|
// process next message in the queue
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#include "includes.h"
|
#include "includes.h"
|
||||||
#include "test_sink.h"
|
|
||||||
#include "spdlog/async.h"
|
#include "spdlog/async.h"
|
||||||
#include "spdlog/sinks/simple_file_sink.h"
|
#include "spdlog/sinks/simple_file_sink.h"
|
||||||
|
#include "test_sink.h"
|
||||||
|
|
||||||
// std::unique_ptr<spdlog::async_logger> create_logger(size_t tp_queue_size, size_t tp_threads)
|
// std::unique_ptr<spdlog::async_logger> create_logger(size_t tp_queue_size, size_t tp_threads)
|
||||||
//{
|
//{
|
||||||
@ -87,7 +87,6 @@ TEST_CASE("multi threads", "[async]")
|
|||||||
{
|
{
|
||||||
logger->info("Hello message #{}", j);
|
logger->info("Hello message #{}", j);
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -96,7 +95,6 @@ TEST_CASE("multi threads", "[async]")
|
|||||||
t.join();
|
t.join();
|
||||||
}
|
}
|
||||||
logger->flush();
|
logger->flush();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
REQUIRE(test_sink->msg_counter() == messages * n_threads);
|
REQUIRE(test_sink->msg_counter() == messages * n_threads);
|
||||||
|
Loading…
Reference in New Issue
Block a user