Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
S
spdlog
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
spdlog
Commits
6651a48c
Commit
6651a48c
authored
May 08, 2019
by
gabime
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wip
parent
c031ae2a
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
65 additions
and
37 deletions
+65
-37
base_sink.cpp
include/spdlog/impl/base_sink.cpp
+54
-0
thread_pool.cpp
include/spdlog/impl/thread_pool.cpp
+0
-2
base_sink.h
include/spdlog/sinks/base_sink.h
+11
-35
No files found.
include/spdlog/impl/base_sink.cpp
0 → 100644
View file @
6651a48c
#ifdef SPDLOG_STATIC_LIB
#include "spdlog/sinks/base_sink.h"
#include "spdlog/details/null_mutex.h"
#include <mutex>
template
class
spdlog
::
sinks
::
base_sink
<
std
::
mutex
>
;
template
class
spdlog
::
sinks
::
base_sink
<
spdlog
::
details
::
null_mutex
>
;
#endif
#include "spdlog/common.h"
#include "spdlog/details/pattern_formatter.h"
template
<
typename
Mutex
>
void
SPDLOG_INLINE
spdlog
::
sinks
::
base_sink
<
Mutex
>::
log
(
const
details
::
log_msg
&
msg
)
{
std
::
lock_guard
<
Mutex
>
lock
(
mutex_
);
sink_it_
(
msg
);
}
template
<
typename
Mutex
>
void
SPDLOG_INLINE
spdlog
::
sinks
::
base_sink
<
Mutex
>::
flush
()
{
std
::
lock_guard
<
Mutex
>
lock
(
mutex_
);
flush_
();
}
template
<
typename
Mutex
>
void
SPDLOG_INLINE
spdlog
::
sinks
::
base_sink
<
Mutex
>::
set_pattern
(
const
std
::
string
&
pattern
)
{
std
::
lock_guard
<
Mutex
>
lock
(
mutex_
);
set_pattern_
(
pattern
);
}
template
<
typename
Mutex
>
void
SPDLOG_INLINE
spdlog
::
sinks
::
base_sink
<
Mutex
>::
set_formatter
(
std
::
unique_ptr
<
spdlog
::
formatter
>
sink_formatter
)
{
std
::
lock_guard
<
Mutex
>
lock
(
mutex_
);
set_formatter_
(
std
::
move
(
sink_formatter
));
}
template
<
typename
Mutex
>
void
SPDLOG_INLINE
spdlog
::
sinks
::
base_sink
<
Mutex
>::
set_pattern_
(
const
std
::
string
&
pattern
)
{
set_formatter_
(
details
::
make_unique
<
spdlog
::
pattern_formatter
>
(
pattern
));
}
template
<
typename
Mutex
>
void
SPDLOG_INLINE
spdlog
::
sinks
::
base_sink
<
Mutex
>::
set_formatter_
(
std
::
unique_ptr
<
spdlog
::
formatter
>
sink_formatter
)
{
formatter_
=
std
::
move
(
sink_formatter
);
}
include/spdlog/impl/thread_pool.cpp
View file @
6651a48c
...
...
@@ -11,8 +11,6 @@ template class spdlog::details::mpmc_blocking_queue<spdlog::details::async_msg>;
SPDLOG_INLINE
spdlog
::
details
::
thread_pool
::
thread_pool
(
size_t
q_max_items
,
size_t
threads_n
)
:
q_
(
q_max_items
)
{
// std::cout << "thread_pool() q_size_bytes: " << q_size_bytes <<
// "\tthreads_n: " << threads_n << std::endl;
if
(
threads_n
==
0
||
threads_n
>
1000
)
{
throw
spdlog_ex
(
"spdlog::thread_pool(): invalid threads_n param (valid "
...
...
include/spdlog/sinks/base_sink.h
View file @
6651a48c
...
...
@@ -13,7 +13,6 @@
#include "spdlog/common.h"
#include "spdlog/details/log_msg.h"
#include "spdlog/formatter.h"
#include "spdlog/sinks/sink.h"
namespace
spdlog
{
...
...
@@ -25,45 +24,21 @@ public:
base_sink
()
=
default
;
base_sink
(
const
base_sink
&
)
=
delete
;
base_sink
&
operator
=
(
const
base_sink
&
)
=
delete
;
void
log
(
const
details
::
log_msg
&
msg
)
final
{
std
::
lock_guard
<
Mutex
>
lock
(
mutex_
);
sink_it_
(
msg
);
}
void
flush
()
final
{
std
::
lock_guard
<
Mutex
>
lock
(
mutex_
);
flush_
();
}
void
set_pattern
(
const
std
::
string
&
pattern
)
final
{
std
::
lock_guard
<
Mutex
>
lock
(
mutex_
);
set_pattern_
(
pattern
);
}
void
set_formatter
(
std
::
unique_ptr
<
spdlog
::
formatter
>
sink_formatter
)
final
{
std
::
lock_guard
<
Mutex
>
lock
(
mutex_
);
set_formatter_
(
std
::
move
(
sink_formatter
));
}
void
log
(
const
details
::
log_msg
&
msg
)
final
;
void
flush
()
final
;
void
set_pattern
(
const
std
::
string
&
pattern
)
final
;
void
set_formatter
(
std
::
unique_ptr
<
spdlog
::
formatter
>
sink_formatter
)
final
;
protected
:
virtual
void
sink_it_
(
const
details
::
log_msg
&
msg
)
=
0
;
virtual
void
flush_
()
=
0
;
virtual
void
set_pattern_
(
const
std
::
string
&
pattern
)
{
set_formatter_
(
details
::
make_unique
<
spdlog
::
pattern_formatter
>
(
pattern
));
}
virtual
void
set_formatter_
(
std
::
unique_ptr
<
spdlog
::
formatter
>
sink_formatter
)
{
formatter_
=
std
::
move
(
sink_formatter
);
}
virtual
void
set_pattern_
(
const
std
::
string
&
pattern
);
virtual
void
set_formatter_
(
std
::
unique_ptr
<
spdlog
::
formatter
>
sink_formatter
);
Mutex
mutex_
;
};
}
// namespace sinks
}
// namespace spdlog
#ifndef SPDLOG_STATIC_LIB
#include "spdlog/impl/base_sink.cpp"
#endif
\ No newline at end of file
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