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
2a0d0092
Commit
2a0d0092
authored
Apr 17, 2015
by
gabime
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
stdout_loggers now thread safe across all instances (share same stdout_sink_mt)
parent
d0874afe
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
5 deletions
+17
-5
spdlog_impl.h
include/spdlog/details/spdlog_impl.h
+4
-4
stdout_sinks.h
include/spdlog/sinks/stdout_sinks.h
+13
-1
No files found.
include/spdlog/details/spdlog_impl.h
View file @
2a0d0092
...
...
@@ -72,22 +72,22 @@ inline std::shared_ptr<spdlog::logger> spdlog::daily_logger_st(const std::string
// Create stdout/stderr loggers
inline
std
::
shared_ptr
<
spdlog
::
logger
>
spdlog
::
stdout_logger_mt
(
const
std
::
string
&
logger_name
)
{
return
create
<
spdlog
::
sinks
::
stdout_sink_mt
>
(
logger_name
);
return
details
::
registry
::
instance
().
create
(
logger_name
,
spdlog
::
sinks
::
stdout_sink_mt
::
instance
()
);
}
inline
std
::
shared_ptr
<
spdlog
::
logger
>
spdlog
::
stdout_logger_st
(
const
std
::
string
&
logger_name
)
{
return
create
<
spdlog
::
sinks
::
stdout_sink_st
>
(
logger_name
);
return
details
::
registry
::
instance
().
create
(
logger_name
,
spdlog
::
sinks
::
stdout_sink_st
::
instance
()
);
}
inline
std
::
shared_ptr
<
spdlog
::
logger
>
spdlog
::
stderr_logger_mt
(
const
std
::
string
&
logger_name
)
{
return
create
<
spdlog
::
sinks
::
stderr_sink_mt
>
(
logger_name
);
return
details
::
registry
::
instance
().
create
(
logger_name
,
spdlog
::
sinks
::
stderr_sink_mt
::
instance
()
);
}
inline
std
::
shared_ptr
<
spdlog
::
logger
>
spdlog
::
stderr_logger_st
(
const
std
::
string
&
logger_name
)
{
return
create
<
spdlog
::
sinks
::
stderr_sink_st
>
(
logger_name
);
return
details
::
registry
::
instance
().
create
(
logger_name
,
spdlog
::
sinks
::
stderr_sink_st
::
instance
()
);
}
#ifdef __linux__
...
...
include/spdlog/sinks/stdout_sinks.h
View file @
2a0d0092
...
...
@@ -37,9 +37,14 @@ namespace sinks
template
<
class
Mutex
>
class
stdout_sink
:
public
ostream_sink
<
Mutex
>
{
using
MyType
=
stdout_sink
<
Mutex
>
;
public
:
stdout_sink
()
:
ostream_sink
<
Mutex
>
(
std
::
cout
,
true
)
{}
static
std
::
shared_ptr
<
MyType
>
instance
()
{
static
std
::
shared_ptr
<
MyType
>
instance
=
std
::
make_shared
<
MyType
>
();
return
instance
;
}
};
typedef
stdout_sink
<
details
::
null_mutex
>
stdout_sink_st
;
...
...
@@ -49,8 +54,15 @@ typedef stdout_sink<std::mutex> stdout_sink_mt;
template
<
class
Mutex
>
class
stderr_sink
:
public
ostream_sink
<
Mutex
>
{
using
MyType
=
stderr_sink
<
Mutex
>
;
public
:
stderr_sink
()
:
ostream_sink
<
Mutex
>
(
std
::
cerr
,
true
)
{}
static
std
::
shared_ptr
<
MyType
>
instance
()
{
static
std
::
shared_ptr
<
MyType
>
instance
=
std
::
make_shared
<
MyType
>
();
return
instance
;
}
};
typedef
stderr_sink
<
std
::
mutex
>
stderr_sink_mt
;
...
...
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