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
5efccfa5
Commit
5efccfa5
authored
Feb 13, 2021
by
Gabi Melman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix #1828
parent
89e737a2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
4 deletions
+13
-4
include/spdlog/sinks/stdout_sinks-inl.h
include/spdlog/sinks/stdout_sinks-inl.h
+12
-2
include/spdlog/sinks/wincolor_sink-inl.h
include/spdlog/sinks/wincolor_sink-inl.h
+1
-2
No files found.
include/spdlog/sinks/stdout_sinks-inl.h
View file @
5efccfa5
...
...
@@ -32,8 +32,13 @@ SPDLOG_INLINE stdout_sink_base<ConsoleMutex>::stdout_sink_base(FILE *file)
{
#ifdef _WIN32
// get windows handle from the FILE* object
handle_
=
(
HANDLE
)
::
_get_osfhandle
(
::
_fileno
(
file_
));
if
(
handle_
==
INVALID_HANDLE_VALUE
)
handle_
=
(
HANDLE
)
::
_get_osfhandle
(
::
_fileno
(
file_
));
// don't throw to support cases where no console is attached,
// and let the log method to do nothing if (handle_ == INVALID_HANDLE_VALUE).
// throw only if non stdout/stderr target is requested (probably regular file and not console).
if
(
handle_
==
INVALID_HANDLE_VALUE
&&
file
!=
stdout
&&
file
!=
stderr
)
{
throw_spdlog_ex
(
"spdlog::stdout_sink_base: _get_osfhandle() failed"
,
errno
);
}
...
...
@@ -43,6 +48,11 @@ SPDLOG_INLINE stdout_sink_base<ConsoleMutex>::stdout_sink_base(FILE *file)
template
<
typename
ConsoleMutex
>
SPDLOG_INLINE
void
stdout_sink_base
<
ConsoleMutex
>::
log
(
const
details
::
log_msg
&
msg
)
{
if
(
handle_
==
INVALID_HANDLE_VALUE
)
{
return
;
}
std
::
lock_guard
<
mutex_t
>
lock
(
mutex_
);
memory_buf_t
formatted
;
formatter_
->
format
(
msg
,
formatted
);
...
...
include/spdlog/sinks/wincolor_sink-inl.h
View file @
5efccfa5
...
...
@@ -59,8 +59,7 @@ template<typename ConsoleMutex>
void
SPDLOG_INLINE
wincolor_sink
<
ConsoleMutex
>::
log
(
const
details
::
log_msg
&
msg
)
{
if
(
out_handle_
==
INVALID_HANDLE_VALUE
)
{
// nothing better to do if we don't have valid handle
{
return
;
}
...
...
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