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
fe20afac
Commit
fe20afac
authored
Sep 21, 2019
by
gabime
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
clang-format
parent
7153db95
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
66 additions
and
69 deletions
+66
-69
circular_q.h
include/spdlog/details/circular_q.h
+3
-3
log_msg_buffer-inl.h
include/spdlog/details/log_msg_buffer-inl.h
+45
-45
log_msg_buffer.h
include/spdlog/details/log_msg_buffer.h
+6
-7
mpmc_blocking_q.h
include/spdlog/details/mpmc_blocking_q.h
+1
-2
os-inl.h
include/spdlog/details/os-inl.h
+6
-6
pattern_formatter-inl.h
include/spdlog/details/pattern_formatter-inl.h
+2
-2
base_sink.h
include/spdlog/sinks/base_sink.h
+0
-1
utils.cpp
tests/utils.cpp
+3
-3
No files found.
include/spdlog/details/circular_q.h
View file @
fe20afac
...
...
@@ -62,12 +62,12 @@ public:
// Return reference to the front item.
// If there are no elements in the container, the behavior is undefined.
const
T
&
front
()
const
const
T
&
front
()
const
{
return
v_
[
head_
];
}
T
&
front
()
T
&
front
()
{
return
v_
[
head_
];
}
...
...
@@ -87,7 +87,7 @@ public:
bool
full
()
const
{
// head is ahead of the tail by 1
if
(
max_items_
>
0
)
if
(
max_items_
>
0
)
{
return
((
tail_
+
1
)
%
max_items_
)
==
head_
;
}
...
...
include/spdlog/details/log_msg_buffer-inl.h
View file @
fe20afac
...
...
@@ -10,51 +10,51 @@
namespace
spdlog
{
namespace
details
{
SPDLOG_INLINE
log_msg_buffer
::
log_msg_buffer
(
const
log_msg
&
orig_msg
)
:
log_msg
{
orig_msg
}
{
buffer
.
append
(
logger_name
.
begin
(),
logger_name
.
end
());
buffer
.
append
(
payload
.
begin
(),
payload
.
end
());
update_string_views
();
}
SPDLOG_INLINE
log_msg_buffer
::
log_msg_buffer
(
const
log_msg_buffer
&
other
)
:
log_msg
{
other
}
{
buffer
.
append
(
logger_name
.
begin
(),
logger_name
.
end
());
buffer
.
append
(
payload
.
begin
(),
payload
.
end
());
update_string_views
();
}
SPDLOG_INLINE
log_msg_buffer
::
log_msg_buffer
(
log_msg_buffer
&&
other
)
:
log_msg
{
std
::
move
(
other
)}
,
buffer
{
std
::
move
(
other
.
buffer
)}
{
update_string_views
();
}
SPDLOG_INLINE
log_msg_buffer
&
log_msg_buffer
::
operator
=
(
const
log_msg_buffer
&
other
)
{
log_msg
::
operator
=
(
other
);
buffer
.
clear
();
buffer
.
append
(
other
.
buffer
.
data
(),
other
.
buffer
.
data
()
+
other
.
buffer
.
size
());
update_string_views
();
return
*
this
;
}
SPDLOG_INLINE
log_msg_buffer
&
log_msg_buffer
::
operator
=
(
log_msg_buffer
&&
other
)
{
log_msg
::
operator
=
(
std
::
move
(
other
));
buffer
=
std
::
move
(
other
.
buffer
);
update_string_views
();
return
*
this
;
}
SPDLOG_INLINE
void
log_msg_buffer
::
update_string_views
()
{
logger_name
=
string_view_t
{
buffer
.
data
(),
logger_name
.
size
()};
payload
=
string_view_t
{
buffer
.
data
()
+
logger_name
.
size
(),
payload
.
size
()};
}
SPDLOG_INLINE
log_msg_buffer
::
log_msg_buffer
(
const
log_msg
&
orig_msg
)
:
log_msg
{
orig_msg
}
{
buffer
.
append
(
logger_name
.
begin
(),
logger_name
.
end
());
buffer
.
append
(
payload
.
begin
(),
payload
.
end
());
update_string_views
();
}
SPDLOG_INLINE
log_msg_buffer
::
log_msg_buffer
(
const
log_msg_buffer
&
other
)
:
log_msg
{
other
}
{
buffer
.
append
(
logger_name
.
begin
(),
logger_name
.
end
());
buffer
.
append
(
payload
.
begin
(),
payload
.
end
());
update_string_views
();
}
SPDLOG_INLINE
log_msg_buffer
::
log_msg_buffer
(
log_msg_buffer
&&
other
)
:
log_msg
{
std
::
move
(
other
)}
,
buffer
{
std
::
move
(
other
.
buffer
)}
{
update_string_views
();
}
SPDLOG_INLINE
log_msg_buffer
&
log_msg_buffer
::
operator
=
(
const
log_msg_buffer
&
other
)
{
log_msg
::
operator
=
(
other
);
buffer
.
clear
();
buffer
.
append
(
other
.
buffer
.
data
(),
other
.
buffer
.
data
()
+
other
.
buffer
.
size
());
update_string_views
();
return
*
this
;
}
SPDLOG_INLINE
log_msg_buffer
&
log_msg_buffer
::
operator
=
(
log_msg_buffer
&&
other
)
{
log_msg
::
operator
=
(
std
::
move
(
other
));
buffer
=
std
::
move
(
other
.
buffer
);
update_string_views
();
return
*
this
;
}
SPDLOG_INLINE
void
log_msg_buffer
::
update_string_views
()
{
logger_name
=
string_view_t
{
buffer
.
data
(),
logger_name
.
size
()};
payload
=
string_view_t
{
buffer
.
data
()
+
logger_name
.
size
(),
payload
.
size
()};
}
}
// namespace details
}
// namespace spdlog
include/spdlog/details/log_msg_buffer.h
View file @
fe20afac
...
...
@@ -14,15 +14,15 @@ namespace details {
class
log_msg_buffer
:
public
log_msg
{
memory_buf_t
buffer
;
void
update_string_views
();
void
update_string_views
();
public
:
log_msg_buffer
()
=
default
;
explicit
log_msg_buffer
(
const
log_msg
&
orig_msg
);
log_msg_buffer
(
const
log_msg_buffer
&
other
);
log_msg_buffer
(
log_msg_buffer
&&
other
);
log_msg_buffer
&
operator
=
(
const
log_msg_buffer
&
other
);
explicit
log_msg_buffer
(
const
log_msg
&
orig_msg
);
log_msg_buffer
(
const
log_msg_buffer
&
other
);
log_msg_buffer
(
log_msg_buffer
&&
other
);
log_msg_buffer
&
operator
=
(
const
log_msg_buffer
&
other
);
log_msg_buffer
&
operator
=
(
log_msg_buffer
&&
other
);
};
}
// namespace details
...
...
@@ -31,4 +31,3 @@ public:
#ifdef SPDLOG_HEADER_ONLY
#include "log_msg_buffer-inl.h"
#endif
include/spdlog/details/mpmc_blocking_q.h
View file @
fe20afac
...
...
@@ -70,7 +70,7 @@ public:
// apparently mingw deadlocks if the mutex is released before cv.notify_one(),
// so release the mutex at the very end each function.
// try to enqueue and block if no room left
// try to enqueue and block if no room left
void
enqueue
(
T
&&
item
)
{
std
::
unique_lock
<
std
::
mutex
>
lock
(
queue_mutex_
);
...
...
@@ -85,7 +85,6 @@ public:
std
::
unique_lock
<
std
::
mutex
>
lock
(
queue_mutex_
);
q_
.
push_back
(
std
::
move
(
item
));
push_cv_
.
notify_one
();
}
// try to dequeue item. if no item found. wait upto timeout and try again
...
...
include/spdlog/details/os-inl.h
View file @
fe20afac
...
...
@@ -51,16 +51,16 @@
#include <sys/syscall.h> //Use gettid() syscall under linux to get thread id
#elif defined(_AIX)
#include <pthread.h>
// for pthread_getthreadid_np
#include <pthread.h> // for pthread_getthreadid_np
#elif defined(__DragonFly__) || defined(__FreeBSD__)
#include <pthread_np.h>
// for pthread_getthreadid_np
#include <pthread_np.h> // for pthread_getthreadid_np
#elif defined(__NetBSD__)
#include <lwp.h>
// for _lwp_self
#include <lwp.h> // for _lwp_self
#elif defined(__sun)
#include <thread.h>
// for thr_self
#include <thread.h> // for thr_self
#endif
#endif // unix
...
...
@@ -396,8 +396,8 @@ SPDLOG_INLINE bool is_color_terminal() SPDLOG_NOEXCEPT
#ifdef _WIN32
return
true
;
#else
static
constexpr
std
::
array
<
const
char
*
,
14
>
Terms
=
{
{
"ansi"
,
"color"
,
"console"
,
"cygwin"
,
"gnome"
,
"konsole"
,
"kterm"
,
"linux"
,
"msys"
,
"putty"
,
"rxvt"
,
"screen"
,
"vt100"
,
"xterm"
}};
static
constexpr
std
::
array
<
const
char
*
,
14
>
Terms
=
{
{
"ansi"
,
"color"
,
"console"
,
"cygwin"
,
"gnome"
,
"konsole"
,
"kterm"
,
"linux"
,
"msys"
,
"putty"
,
"rxvt"
,
"screen"
,
"vt100"
,
"xterm"
}};
const
char
*
env_p
=
std
::
getenv
(
"TERM"
);
if
(
env_p
==
nullptr
)
...
...
include/spdlog/details/pattern_formatter-inl.h
View file @
fe20afac
...
...
@@ -209,8 +209,8 @@ public:
};
// Full month name
static
const
std
::
array
<
const
char
*
,
12
>
full_months
{
{
"January"
,
"February"
,
"March"
,
"April"
,
"May"
,
"June"
,
"July"
,
"August"
,
"September"
,
"October"
,
"November"
,
"December"
}};
static
const
std
::
array
<
const
char
*
,
12
>
full_months
{
{
"January"
,
"February"
,
"March"
,
"April"
,
"May"
,
"June"
,
"July"
,
"August"
,
"September"
,
"October"
,
"November"
,
"December"
}};
template
<
typename
ScopedPadder
>
class
B_formatter
:
public
flag_formatter
...
...
include/spdlog/sinks/base_sink.h
View file @
fe20afac
...
...
@@ -13,7 +13,6 @@
#include "spdlog/details/log_msg.h"
#include "spdlog/sinks/sink.h"
namespace
spdlog
{
namespace
sinks
{
template
<
typename
Mutex
>
...
...
tests/utils.cpp
View file @
fe20afac
...
...
@@ -77,15 +77,15 @@ std::size_t count_files(const std::string &folder)
{
size_t
counter
=
0
;
WIN32_FIND_DATA
ffd
;
// Start iterating over the files in the folder directory.
HANDLE
hFind
=
::
FindFirstFileA
((
folder
+
"
\\
*"
).
c_str
(),
&
ffd
);
if
(
hFind
!=
INVALID_HANDLE_VALUE
)
{
do
// Managed to locate and create an handle to that folder.
{
if
(
ffd
.
cFileName
[
0
]
!=
'.'
)
counter
++
;
if
(
ffd
.
cFileName
[
0
]
!=
'.'
)
counter
++
;
}
while
(
::
FindNextFile
(
hFind
,
&
ffd
)
!=
0
);
::
FindClose
(
hFind
);
}
...
...
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