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
80163dc6
Commit
80163dc6
authored
Feb 23, 2018
by
gabime
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Better support for WinRT
parent
a8b5bb89
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
5 deletions
+9
-5
include/spdlog/details/os.h
include/spdlog/details/os.h
+6
-3
include/spdlog/details/spdlog_impl.h
include/spdlog/details/spdlog_impl.h
+3
-2
No files found.
include/spdlog/details/os.h
View file @
80163dc6
...
...
@@ -154,10 +154,13 @@ SPDLOG_CONSTEXPR static const char folder_sep = '/';
inline
void
prevent_child_fd
(
FILE
*
f
)
{
#ifdef _WIN32
#if !defined(__cplusplus_winrt)
auto
file_handle
=
(
HANDLE
)
_get_osfhandle
(
_fileno
(
f
));
if
(
!::
SetHandleInformation
(
file_handle
,
HANDLE_FLAG_INHERIT
,
0
))
throw
spdlog_ex
(
"SetHandleInformation failed"
,
errno
);
#endif
#else
auto
fd
=
fileno
(
f
);
if
(
fcntl
(
fd
,
F_SETFD
,
FD_CLOEXEC
)
==
-
1
)
...
...
@@ -351,7 +354,7 @@ inline size_t _thread_id()
//Return current thread id as size_t (from thread local storage)
inline
size_t
thread_id
()
{
#if defined(SPDLOG_DISABLE_TID_CACHING) || (defined(_MSC_VER) && (_MSC_VER < 1900)) || (defined(__clang__) && !__has_feature(cxx_thread_local))
#if defined(SPDLOG_DISABLE_TID_CACHING) || (defined(_MSC_VER) && (_MSC_VER < 1900)) ||
defined(__cplusplus_winrt ) ||
(defined(__clang__) && !__has_feature(cxx_thread_local))
return
_thread_id
();
#else // cache thread id in tls
static
thread_local
const
size_t
tid
=
_thread_id
();
...
...
@@ -367,7 +370,7 @@ inline size_t thread_id()
inline
void
sleep_for_millis
(
int
milliseconds
)
{
#if defined(_WIN32)
Sleep
(
milliseconds
);
::
Sleep
(
milliseconds
);
#else
std
::
this_thread
::
sleep_for
(
std
::
chrono
::
milliseconds
(
milliseconds
));
#endif
...
...
@@ -436,7 +439,7 @@ inline int pid()
{
#ifdef _WIN32
return
::
_getpid
(
);
return
static_cast
<
int
>
(
::
GetCurrentProcessId
()
);
#else
return
static_cast
<
int
>
(
::
getpid
());
#endif
...
...
include/spdlog/details/spdlog_impl.h
View file @
80163dc6
...
...
@@ -16,7 +16,7 @@
#include "../sinks/syslog_sink.h"
#endif
#if
def _WIN32
#if
defined _WIN32 && !defined(__cplusplus_winrt)
#include "../sinks/wincolor_sink.h"
#else
#include "../sinks/ansicolor_sink.h"
...
...
@@ -107,7 +107,8 @@ inline std::shared_ptr<spdlog::logger> spdlog::stderr_logger_st(const std::strin
//
// stdout/stderr color loggers
//
#ifdef _WIN32
#if defined _WIN32 && !defined(__cplusplus_winrt)
inline
std
::
shared_ptr
<
spdlog
::
logger
>
spdlog
::
stdout_color_mt
(
const
std
::
string
&
logger_name
)
{
auto
sink
=
std
::
make_shared
<
spdlog
::
sinks
::
wincolor_stdout_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