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
0684b4f3
Commit
0684b4f3
authored
Apr 07, 2015
by
gabime
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use size_t to better represent thread id across platforms
parent
7105fdad
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
9 additions
and
8 deletions
+9
-8
include/spdlog/common.h
include/spdlog/common.h
+1
-0
include/spdlog/details/async_log_helper.h
include/spdlog/details/async_log_helper.h
+3
-3
include/spdlog/details/log_msg.h
include/spdlog/details/log_msg.h
+1
-1
include/spdlog/details/os.h
include/spdlog/details/os.h
+4
-4
No files found.
include/spdlog/common.h
View file @
0684b4f3
...
...
@@ -59,6 +59,7 @@ using log_clock = std::chrono::system_clock;
using
sink_ptr
=
std
::
shared_ptr
<
sinks
::
sink
>
;
using
sinks_init_list
=
std
::
initializer_list
<
sink_ptr
>
;
using
formatter_ptr
=
std
::
shared_ptr
<
spdlog
::
formatter
>
;
using
thread_id
=
std
::
size_t
;
//Log level enum
namespace
level
...
...
include/spdlog/details/async_log_helper.h
View file @
0684b4f3
...
...
@@ -59,7 +59,7 @@ class async_log_helper
std
::
string
logger_name
;
level
::
level_enum
level
;
log_clock
::
time_point
time
;
uint64_t
thread_id
;
thread_id
thread_id
;
std
::
string
txt
;
async_msg
()
=
default
;
...
...
@@ -77,7 +77,7 @@ async_msg(async_msg&& other) SPDLOG_NOEXCEPT:
logger_name
=
std
::
move
(
other
.
logger_name
);
level
=
other
.
level
;
time
=
std
::
move
(
other
.
time
);
thread_id
=
other
.
thread_id
;
thread_id
=
other
.
thread_id
;
txt
=
std
::
move
(
other
.
txt
);
return
*
this
;
}
...
...
@@ -90,7 +90,7 @@ async_msg(async_msg&& other) SPDLOG_NOEXCEPT:
logger_name
(
m
.
logger_name
),
level
(
m
.
level
),
time
(
m
.
time
),
thread_id
(
m
.
thread_id
),
thread_id
(
m
.
thread_id
),
txt
(
m
.
raw
.
data
(),
m
.
raw
.
size
())
{}
...
...
include/spdlog/details/log_msg.h
View file @
0684b4f3
...
...
@@ -92,7 +92,7 @@ struct log_msg
std
::
string
logger_name
;
level
::
level_enum
level
;
log_clock
::
time_point
time
;
uint64_t
thread_id
;
thread_id
thread_id
;
fmt
::
MemoryWriter
raw
;
fmt
::
MemoryWriter
formatted
;
};
...
...
include/spdlog/details/os.h
View file @
0684b4f3
...
...
@@ -32,11 +32,11 @@
# define WIN32_LEAN_AND_MEAN
# endif
# include <Windows.h>
#elif __linux__
#elif __linux__
#include <sys/syscall.h> //Use gettid() syscall under linux to get thread id
#include <unistd.h>
#else
#include <pthread.h>
#include <pthread.h>
#endif
#include "../common.h"
...
...
@@ -172,14 +172,14 @@ inline int utc_minutes_offset(const std::tm& tm = details::os::localtime())
}
//Return current thread id as 64 bit integer
inline
uint64
_t
thread_id
()
inline
size
_t
thread_id
()
{
#ifdef _WIN32
return
::
GetCurrentThreadId
();
#elif __linux__
return
(
uint64_t
)
syscall
(
SYS_gettid
);
#else
#else
return
(
uint64_t
)
pthread_self
();
#endif
...
...
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