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
65407539
Commit
65407539
authored
Aug 23, 2019
by
gabime
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed log_msg_buffer
parent
54306068
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
7 deletions
+24
-7
include/spdlog/details/log_msg_buffer.h
include/spdlog/details/log_msg_buffer.h
+24
-7
No files found.
include/spdlog/details/log_msg_buffer.h
View file @
65407539
...
...
@@ -12,23 +12,40 @@ namespace details {
// extend log_msg with internal buffer to store its payload.
// this is needed since log_msg holds string_views that points to stack data.
struct
log_msg_buffer
:
log_msg
class
log_msg_buffer
:
public
log_msg
{
fmt
::
basic_memory_buffer
<
char
,
200
>
buffer
;
void
update_string_views
()
{
logger_name
=
string_view_t
{
buffer
.
data
(),
logger_name
.
size
()};
payload
=
string_view_t
{
logger_name
.
end
(),
payload
.
size
()};
}
public:
log_msg_buffer
()
=
default
;
explicit
log_msg_buffer
(
const
log_msg
&
orig_msg
)
:
log_msg
(
orig_msg
)
:
log_msg
{
orig_msg
}
{
buffer
.
append
(
logger_name
.
begin
(),
logger_name
.
end
());
logger_name
=
string_view_t
{
buffer
.
data
(),
buffer
.
size
()};
buffer
.
append
(
payload
.
begin
(),
payload
.
end
());
payload
=
string_view_t
{
logger_name
.
end
(),
payload
.
size
()}
;
update_string_views
()
;
}
log_msg_buffer
(
log_msg_buffer
&&
other
)
=
default
;
log_msg_buffer
&
operator
=
(
log_msg_buffer
&&
other
)
=
default
;
log_msg_buffer
(
log_msg_buffer
&&
other
)
:
log_msg
{
std
::
move
(
other
)}
,
buffer
{
std
::
move
(
other
.
buffer
)}
{
update_string_views
();
}
log_msg_buffer
&
operator
=
(
log_msg_buffer
&&
other
)
{
log_msg
::
operator
=
(
std
::
move
(
other
));
buffer
=
std
::
move
(
other
.
buffer
);
update_string_views
();
return
*
this
;
}
};
}
// namespace details
...
...
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