Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
spdlog
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
spdlog
Commits
036cc5d5
Unverified
Commit
036cc5d5
authored
Jun 27, 2021
by
Gabi Melman
Committed by
GitHub
Jun 27, 2021
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1982 from mguludag/v1.x
ignore pattern formatting
parents
2a09f66a
14950926
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
6 deletions
+2
-6
include/spdlog/sinks/mongo_sink.h
include/spdlog/sinks/mongo_sink.h
+2
-6
No files found.
include/spdlog/sinks/mongo_sink.h
View file @
036cc5d5
...
@@ -12,7 +12,6 @@
...
@@ -12,7 +12,6 @@
#include "spdlog/common.h"
#include "spdlog/common.h"
#include "spdlog/details/log_msg.h"
#include "spdlog/details/log_msg.h"
#include "spdlog/pattern_formatter.h"
#include "spdlog/sinks/base_sink.h"
#include "spdlog/sinks/base_sink.h"
#include <spdlog/details/synchronous_factory.h>
#include <spdlog/details/synchronous_factory.h>
...
@@ -34,8 +33,7 @@ public:
...
@@ -34,8 +33,7 @@ public:
client_
=
std
::
make_unique
<
mongocxx
::
client
>
(
mongocxx
::
uri
{
uri
});
client_
=
std
::
make_unique
<
mongocxx
::
client
>
(
mongocxx
::
uri
{
uri
});
db_name_
=
db_name
;
db_name_
=
db_name
;
coll_name_
=
collection_name
;
coll_name_
=
collection_name
;
set_pattern
(
"%v"
);
}
catch
(
const
std
::
exception
)
{
}
catch
(
const
std
::
exception
&
e
)
{
throw
spdlog_ex
(
"Error opening database"
);
throw
spdlog_ex
(
"Error opening database"
);
}
}
}
}
...
@@ -48,12 +46,10 @@ protected:
...
@@ -48,12 +46,10 @@ protected:
using
bsoncxx
::
builder
::
stream
::
finalize
;
using
bsoncxx
::
builder
::
stream
::
finalize
;
if
(
client_
!=
nullptr
)
{
if
(
client_
!=
nullptr
)
{
memory_buf_t
formatted
;
base_sink
<
Mutex
>::
formatter_
->
format
(
msg
,
formatted
);
auto
doc
=
document
{}
auto
doc
=
document
{}
<<
"timestamp"
<<
bsoncxx
::
types
::
b_date
(
msg
.
time
)
<<
"level"
<<
"timestamp"
<<
bsoncxx
::
types
::
b_date
(
msg
.
time
)
<<
"level"
<<
level
::
to_string_view
(
msg
.
level
).
data
()
<<
"message"
<<
level
::
to_string_view
(
msg
.
level
).
data
()
<<
"message"
<<
std
::
string
(
formatted
.
begin
(),
formatte
d
.
end
())
<<
std
::
string
(
msg
.
payload
.
begin
(),
msg
.
payloa
d
.
end
())
<<
"logger_name"
<<
"logger_name"
<<
std
::
string
(
msg
.
logger_name
.
begin
(),
msg
.
logger_name
.
end
())
<<
std
::
string
(
msg
.
logger_name
.
begin
(),
msg
.
logger_name
.
end
())
<<
"thread_id"
<<
static_cast
<
int
>
(
msg
.
thread_id
)
<<
finalize
;
<<
"thread_id"
<<
static_cast
<
int
>
(
msg
.
thread_id
)
<<
finalize
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment