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
f1718fb5
Commit
f1718fb5
authored
Aug 22, 2019
by
gabime
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
clang-format
parent
6b527a50
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
29 additions
and
31 deletions
+29
-31
include/spdlog/details/log_msg_buffer.h
include/spdlog/details/log_msg_buffer.h
+13
-10
include/spdlog/details/thread_pool.h
include/spdlog/details/thread_pool.h
+4
-7
include/spdlog/sinks/backtrace-sink.h
include/spdlog/sinks/backtrace-sink.h
+12
-13
include/spdlog/sinks/daily_file_sink.h
include/spdlog/sinks/daily_file_sink.h
+0
-1
No files found.
include/spdlog/details/log_msg_buffer.h
View file @
f1718fb5
...
...
@@ -17,31 +17,34 @@ struct log_msg_buffer : log_msg
fmt
::
basic_memory_buffer
<
char
,
200
>
payload_buf
;
log_msg_buffer
()
=
default
;
log_msg_buffer
(
const
log_msg
&
orig_msg
)
:
log_msg
(
orig_msg
)
log_msg_buffer
(
const
log_msg
&
orig_msg
)
:
log_msg
(
orig_msg
)
{
update_buffers
();
}
log_msg_buffer
(
const
log_msg_buffer
&
other
)
:
log_msg
(
other
)
log_msg_buffer
(
const
log_msg_buffer
&
other
)
:
log_msg
(
other
)
{
update_buffers
();
}
log_msg_buffer
(
const
log_msg_buffer
&&
other
)
:
log_msg
(
std
::
move
(
other
))
log_msg_buffer
(
const
log_msg_buffer
&&
other
)
:
log_msg
(
std
::
move
(
other
))
{
update_buffers
();
}
log_msg_buffer
&
operator
=
(
log_msg_buffer
&
other
)
SPDLOG_NOEXCEPT
log_msg_buffer
&
operator
=
(
log_msg_buffer
&
other
)
SPDLOG_NOEXCEPT
{
*
static_cast
<
log_msg
*>
(
this
)
=
other
;
*
static_cast
<
log_msg
*>
(
this
)
=
other
;
update_buffers
();
return
*
this
;
}
log_msg_buffer
&
operator
=
(
log_msg_buffer
&&
other
)
SPDLOG_NOEXCEPT
log_msg_buffer
&
operator
=
(
log_msg_buffer
&&
other
)
SPDLOG_NOEXCEPT
{
*
static_cast
<
log_msg
*>
(
this
)
=
std
::
move
(
other
);
*
static_cast
<
log_msg
*>
(
this
)
=
std
::
move
(
other
);
update_buffers
();
return
*
this
;
}
...
...
@@ -53,10 +56,10 @@ struct log_msg_buffer : log_msg
logger_name
=
string_view_t
{
loggername_buf
.
data
(),
loggername_buf
.
size
()};
payload_buf
.
clear
();
payload_buf
.
append
(
payload
.
data
(),
payload
.
data
()
+
payload
.
size
());
payload_buf
.
append
(
payload
.
data
(),
payload
.
data
()
+
payload
.
size
());
payload
=
string_view_t
{
payload_buf
.
data
(),
payload_buf
.
size
()};
}
};
}
}
\ No newline at end of file
}
// namespace details
}
// namespace spdlog
\ No newline at end of file
include/spdlog/details/thread_pool.h
View file @
f1718fb5
...
...
@@ -7,7 +7,6 @@
#include "spdlog/details/mpmc_blocking_q.h"
#include "spdlog/details/os.h"
#include <chrono>
#include <memory>
#include <thread>
...
...
@@ -31,9 +30,9 @@ enum class async_msg_type
#include "spdlog/details/log_msg_buffer.h"
// Async msg to move to/from the queue
// Movable only. should never be copied
struct
async_msg
:
log_msg_buffer
struct
async_msg
:
log_msg_buffer
{
async_msg_type
msg_type
{
async_msg_type
::
log
};
async_msg_type
msg_type
{
async_msg_type
::
log
};
async_logger_ptr
worker_ptr
;
async_msg
()
=
default
;
...
...
@@ -53,7 +52,7 @@ struct async_msg:log_msg_buffer
async_msg
&
operator
=
(
async_msg
&&
other
)
{
*
static_cast
<
log_msg_buffer
*>
(
this
)
=
std
::
move
(
other
);
*
static_cast
<
log_msg_buffer
*>
(
this
)
=
std
::
move
(
other
);
msg_type
=
other
.
msg_type
;
worker_ptr
=
std
::
move
(
other
.
worker_ptr
);
return
*
this
;
...
...
@@ -68,8 +67,7 @@ struct async_msg:log_msg_buffer
:
log_msg_buffer
(
m
)
,
msg_type
(
the_type
)
,
worker_ptr
(
std
::
move
(
worker
))
{
}
{}
async_msg
(
async_logger_ptr
&&
worker
,
async_msg_type
the_type
)
:
log_msg_buffer
()
...
...
@@ -80,7 +78,6 @@ struct async_msg:log_msg_buffer
explicit
async_msg
(
async_msg_type
the_type
)
:
async_msg
(
nullptr
,
the_type
)
{}
};
class
thread_pool
...
...
include/spdlog/sinks/backtrace-sink.h
View file @
f1718fb5
...
...
@@ -34,7 +34,6 @@
// l.warn("This will trigger the log of all prev messages in the queue");
// }
namespace
spdlog
{
namespace
sinks
{
template
<
typename
Mutex
>
...
...
@@ -42,7 +41,8 @@ class backtrace_sink : public dist_sink<Mutex>
{
public:
explicit
backtrace_sink
(
level
::
level_enum
trigger_level
=
spdlog
::
level
::
warn
,
size_t
n_messages
=
32
)
:
trigger_level_
{
trigger_level
},
traceback_msgs_
{
n_messages
}
:
trigger_level_
{
trigger_level
}
,
traceback_msgs_
{
n_messages
}
{}
protected:
...
...
@@ -54,40 +54,39 @@ protected:
// otherwise save the message in the queue for future trigger.
void
sink_it_
(
const
details
::
log_msg
&
msg
)
override
{
if
(
msg
.
level
<
trigger_level_
)
if
(
msg
.
level
<
trigger_level_
)
{
traceback_msgs_
.
push_back
(
details
::
log_msg_buffer
(
msg
));
}
if
(
msg
.
level
>
level
::
debug
)
if
(
msg
.
level
>
level
::
debug
)
{
dist_sink
<
Mutex
>::
sink_it_
(
msg
);
}
if
(
msg
.
level
>=
trigger_level_
)
if
(
msg
.
level
>=
trigger_level_
)
{
log_backtrace_
(
msg
.
logger_name
);
}
}
void
log_backtrace_
(
const
string_view_t
&
logger_name
)
void
log_backtrace_
(
const
string_view_t
&
logger_name
)
{
if
(
traceback_msgs_
.
empty
())
if
(
traceback_msgs_
.
empty
())
{
return
;
}
dist_sink
<
Mutex
>::
sink_it_
(
details
::
log_msg
{
logger_name
,
level
::
info
,
"********************* [Backtrace Start] *********************"
});
dist_sink
<
Mutex
>::
sink_it_
(
details
::
log_msg
{
logger_name
,
level
::
info
,
"********************* [Backtrace Start] *********************"
});
do
{
details
::
log_msg_buffer
popped
;
traceback_msgs_
.
pop_front
(
popped
);
dist_sink
<
Mutex
>::
sink_it_
(
popped
);
}
while
(
!
traceback_msgs_
.
empty
());
}
while
(
!
traceback_msgs_
.
empty
());
dist_sink
<
Mutex
>::
sink_it_
(
details
::
log_msg
{
logger_name
,
level
::
info
,
"********************* [Backtrace End] ***********************"
});
dist_sink
<
Mutex
>::
sink_it_
(
details
::
log_msg
{
logger_name
,
level
::
info
,
"********************* [Backtrace End] ***********************"
});
}
};
...
...
include/spdlog/sinks/daily_file_sink.h
View file @
f1718fb5
...
...
@@ -11,7 +11,6 @@
#include "spdlog/details/os.h"
#include "spdlog/details/synchronous_factory.h"
#include <chrono>
#include <cstdio>
#include <ctime>
...
...
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