mirror of
https://github.com/gabime/spdlog.git
synced 2025-01-12 17:00:25 +08:00
Add numerical level to Mongo sink for easier queries
Filtering to a certain log level or above, a useful operation, can now be done with an integer comparison as opposed to comparing to a list of strings in the database query.
This commit is contained in:
parent
f3b61c70ba
commit
0145223be1
@ -56,7 +56,8 @@ protected:
|
|||||||
|
|
||||||
if (client_ != nullptr)
|
if (client_ != nullptr)
|
||||||
{
|
{
|
||||||
auto doc = document{} << "timestamp" << bsoncxx::types::b_date(msg.time) << "level" << level::to_string_view(msg.level).data()
|
auto doc = document{} << "timestamp" << bsoncxx::types::b_date(msg.time)
|
||||||
|
<< "level" << level::to_string_view(msg.level).data() << "level_num" << msg.level
|
||||||
<< "message" << std::string(msg.payload.begin(), msg.payload.end()) << "logger_name"
|
<< "message" << std::string(msg.payload.begin(), msg.payload.end()) << "logger_name"
|
||||||
<< std::string(msg.logger_name.begin(), msg.logger_name.end()) << "thread_id"
|
<< std::string(msg.logger_name.begin(), msg.logger_name.end()) << "thread_id"
|
||||||
<< static_cast<int>(msg.thread_id) << finalize;
|
<< static_cast<int>(msg.thread_id) << finalize;
|
||||||
|
Loading…
Reference in New Issue
Block a user