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
29f2eeea
Commit
29f2eeea
authored
Jun 27, 2019
by
gabime
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removed formatter_ member from the sink interface
parent
cf152e60
Show whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
48 additions
and
44 deletions
+48
-44
ansicolor_sink-inl.h
include/spdlog/sinks/ansicolor_sink-inl.h
+1
-0
ansicolor_sink.h
include/spdlog/sinks/ansicolor_sink.h
+1
-0
base_sink-inl.h
include/spdlog/sinks/base_sink-inl.h
+12
-0
base_sink.h
include/spdlog/sinks/base_sink.h
+6
-2
basic_file_sink-inl.h
include/spdlog/sinks/basic_file_sink-inl.h
+1
-1
daily_file_sink.h
include/spdlog/sinks/daily_file_sink.h
+1
-1
dup_filter_sink.h
include/spdlog/sinks/dup_filter_sink.h
+3
-5
msvc_sink.h
include/spdlog/sinks/msvc_sink.h
+1
-1
ostream_sink.h
include/spdlog/sinks/ostream_sink.h
+1
-1
rotating_file_sink-inl.h
include/spdlog/sinks/rotating_file_sink-inl.h
+1
-1
sink-inl.h
include/spdlog/sinks/sink-inl.h
+1
-9
sink.h
include/spdlog/sinks/sink.h
+1
-9
stdout_sinks-inl.h
include/spdlog/sinks/stdout_sinks-inl.h
+1
-0
stdout_sinks.h
include/spdlog/sinks/stdout_sinks.h
+2
-1
syslog_sink.h
include/spdlog/sinks/syslog_sink.h
+1
-1
wincolor_sink-inl.h
include/spdlog/sinks/wincolor_sink-inl.h
+4
-1
wincolor_sink.h
include/spdlog/sinks/wincolor_sink.h
+2
-1
test_dup_filter.cpp
tests/test_dup_filter.cpp
+8
-10
No files found.
include/spdlog/sinks/ansicolor_sink-inl.h
View file @
29f2eeea
...
@@ -16,6 +16,7 @@ template<typename ConsoleMutex>
...
@@ -16,6 +16,7 @@ template<typename ConsoleMutex>
SPDLOG_INLINE
ansicolor_sink
<
ConsoleMutex
>::
ansicolor_sink
(
FILE
*
target_file
,
color_mode
mode
)
SPDLOG_INLINE
ansicolor_sink
<
ConsoleMutex
>::
ansicolor_sink
(
FILE
*
target_file
,
color_mode
mode
)
:
target_file_
(
target_file
)
:
target_file_
(
target_file
)
,
mutex_
(
ConsoleMutex
::
mutex
())
,
mutex_
(
ConsoleMutex
::
mutex
())
,
formatter_
(
details
::
make_unique
<
spdlog
::
pattern_formatter
>
())
{
{
set_color_mode
(
mode
);
set_color_mode
(
mode
);
...
...
include/spdlog/sinks/ansicolor_sink.h
View file @
29f2eeea
...
@@ -79,6 +79,7 @@ private:
...
@@ -79,6 +79,7 @@ private:
FILE
*
target_file_
;
FILE
*
target_file_
;
mutex_t
&
mutex_
;
mutex_t
&
mutex_
;
bool
should_do_colors_
;
bool
should_do_colors_
;
std
::
unique_ptr
<
spdlog
::
formatter
>
formatter_
;
std
::
unordered_map
<
level
::
level_enum
,
string_view_t
,
level
::
level_hasher
>
colors_
;
std
::
unordered_map
<
level
::
level_enum
,
string_view_t
,
level
::
level_hasher
>
colors_
;
void
print_ccode_
(
const
string_view_t
&
color_code
);
void
print_ccode_
(
const
string_view_t
&
color_code
);
void
print_range_
(
const
fmt
::
memory_buffer
&
formatted
,
size_t
start
,
size_t
end
);
void
print_range_
(
const
fmt
::
memory_buffer
&
formatted
,
size_t
start
,
size_t
end
);
...
...
include/spdlog/sinks/base_sink-inl.h
View file @
29f2eeea
...
@@ -10,6 +10,18 @@
...
@@ -10,6 +10,18 @@
#include "spdlog/common.h"
#include "spdlog/common.h"
#include "spdlog/details/pattern_formatter.h"
#include "spdlog/details/pattern_formatter.h"
#include <memory>
template
<
typename
Mutex
>
SPDLOG_INLINE
spdlog
::
sinks
::
base_sink
<
Mutex
>::
base_sink
()
:
formatter_
{
details
::
make_unique
<
spdlog
::
pattern_formatter
>
()}
{}
template
<
typename
Mutex
>
SPDLOG_INLINE
spdlog
::
sinks
::
base_sink
<
Mutex
>::
base_sink
(
std
::
unique_ptr
<
spdlog
::
formatter
>
formatter
)
:
formatter_
{
std
::
move
(
formatter
)}
{}
template
<
typename
Mutex
>
template
<
typename
Mutex
>
void
SPDLOG_INLINE
spdlog
::
sinks
::
base_sink
<
Mutex
>::
log
(
const
details
::
log_msg
&
msg
)
void
SPDLOG_INLINE
spdlog
::
sinks
::
base_sink
<
Mutex
>::
log
(
const
details
::
log_msg
&
msg
)
{
{
...
...
include/spdlog/sinks/base_sink.h
View file @
29f2eeea
...
@@ -19,7 +19,8 @@ template<typename Mutex>
...
@@ -19,7 +19,8 @@ template<typename Mutex>
class
base_sink
:
public
sink
class
base_sink
:
public
sink
{
{
public
:
public
:
base_sink
()
=
default
;
base_sink
();
explicit
base_sink
(
std
::
unique_ptr
<
spdlog
::
formatter
>
formatter
);
base_sink
(
const
base_sink
&
)
=
delete
;
base_sink
(
const
base_sink
&
)
=
delete
;
base_sink
&
operator
=
(
const
base_sink
&
)
=
delete
;
base_sink
&
operator
=
(
const
base_sink
&
)
=
delete
;
void
log
(
const
details
::
log_msg
&
msg
)
final
;
void
log
(
const
details
::
log_msg
&
msg
)
final
;
...
@@ -28,11 +29,14 @@ public:
...
@@ -28,11 +29,14 @@ public:
void
set_formatter
(
std
::
unique_ptr
<
spdlog
::
formatter
>
sink_formatter
)
final
;
void
set_formatter
(
std
::
unique_ptr
<
spdlog
::
formatter
>
sink_formatter
)
final
;
protected
:
protected
:
// sink formatter
std
::
unique_ptr
<
spdlog
::
formatter
>
formatter_
;
Mutex
mutex_
;
virtual
void
sink_it_
(
const
details
::
log_msg
&
msg
)
=
0
;
virtual
void
sink_it_
(
const
details
::
log_msg
&
msg
)
=
0
;
virtual
void
flush_
()
=
0
;
virtual
void
flush_
()
=
0
;
virtual
void
set_pattern_
(
const
std
::
string
&
pattern
);
virtual
void
set_pattern_
(
const
std
::
string
&
pattern
);
virtual
void
set_formatter_
(
std
::
unique_ptr
<
spdlog
::
formatter
>
sink_formatter
);
virtual
void
set_formatter_
(
std
::
unique_ptr
<
spdlog
::
formatter
>
sink_formatter
);
Mutex
mutex_
;
};
};
}
// namespace sinks
}
// namespace sinks
}
// namespace spdlog
}
// namespace spdlog
...
...
include/spdlog/sinks/basic_file_sink-inl.h
View file @
29f2eeea
...
@@ -29,7 +29,7 @@ template<typename Mutex>
...
@@ -29,7 +29,7 @@ template<typename Mutex>
SPDLOG_INLINE
void
basic_file_sink
<
Mutex
>::
sink_it_
(
const
details
::
log_msg
&
msg
)
SPDLOG_INLINE
void
basic_file_sink
<
Mutex
>::
sink_it_
(
const
details
::
log_msg
&
msg
)
{
{
fmt
::
memory_buffer
formatted
;
fmt
::
memory_buffer
formatted
;
sink
::
formatter_
->
format
(
msg
,
formatted
);
base_sink
<
Mutex
>
::
formatter_
->
format
(
msg
,
formatted
);
file_helper_
.
write
(
formatted
);
file_helper_
.
write
(
formatted
);
}
}
...
...
include/spdlog/sinks/daily_file_sink.h
View file @
29f2eeea
...
@@ -74,7 +74,7 @@ protected:
...
@@ -74,7 +74,7 @@ protected:
rotation_tp_
=
next_rotation_tp_
();
rotation_tp_
=
next_rotation_tp_
();
}
}
fmt
::
memory_buffer
formatted
;
fmt
::
memory_buffer
formatted
;
sink
::
formatter_
->
format
(
msg
,
formatted
);
base_sink
<
Mutex
>
::
formatter_
->
format
(
msg
,
formatted
);
file_helper_
.
write
(
formatted
);
file_helper_
.
write
(
formatted
);
}
}
...
...
include/spdlog/sinks/dup_filter_sink.h
View file @
29f2eeea
...
@@ -33,8 +33,6 @@
...
@@ -33,8 +33,6 @@
// [2019-06-25 17:50:56.512] [logger] [info] Skipped 3 duplicate messages..
// [2019-06-25 17:50:56.512] [logger] [info] Skipped 3 duplicate messages..
// [2019-06-25 17:50:56.512] [logger] [info] Different Hello
// [2019-06-25 17:50:56.512] [logger] [info] Different Hello
namespace
spdlog
{
namespace
spdlog
{
namespace
sinks
{
namespace
sinks
{
template
<
typename
Mutex
>
template
<
typename
Mutex
>
...
@@ -55,14 +53,14 @@ protected:
...
@@ -55,14 +53,14 @@ protected:
void
sink_it_
(
const
details
::
log_msg
&
msg
)
override
void
sink_it_
(
const
details
::
log_msg
&
msg
)
override
{
{
bool
filtered
=
filter_
(
msg
);
bool
filtered
=
filter_
(
msg
);
if
(
!
filtered
)
if
(
!
filtered
)
{
{
skip_counter_
+=
1
;
skip_counter_
+=
1
;
return
;
return
;
}
}
// log the "skipped.." message
// log the "skipped.." message
if
(
skip_counter_
>
0
)
if
(
skip_counter_
>
0
)
{
{
fmt
::
basic_memory_buffer
<
char
,
64
>
buf
;
fmt
::
basic_memory_buffer
<
char
,
64
>
buf
;
fmt
::
format_to
(
buf
,
"Skipped {} duplicate messages.."
,
skip_counter_
);
fmt
::
format_to
(
buf
,
"Skipped {} duplicate messages.."
,
skip_counter_
);
...
@@ -72,7 +70,7 @@ protected:
...
@@ -72,7 +70,7 @@ protected:
// log current message
// log current message
dist_sink
<
Mutex
>::
sink_it_
(
msg
);
dist_sink
<
Mutex
>::
sink_it_
(
msg
);
last_msg_time_
=
msg
.
time
;
last_msg_time_
=
msg
.
time
;
skip_counter_
=
0
;
skip_counter_
=
0
;
last_msg_payload_
.
assign
(
msg
.
payload
.
data
(),
msg
.
payload
.
data
()
+
msg
.
payload
.
size
());
last_msg_payload_
.
assign
(
msg
.
payload
.
data
(),
msg
.
payload
.
data
()
+
msg
.
payload
.
size
());
}
}
...
...
include/spdlog/sinks/msvc_sink.h
View file @
29f2eeea
...
@@ -29,7 +29,7 @@ protected:
...
@@ -29,7 +29,7 @@ protected:
{
{
fmt
::
memory_buffer
formatted
;
fmt
::
memory_buffer
formatted
;
sink
::
formatter_
->
format
(
msg
,
formatted
);
base_sink
<
Mutex
>
::
formatter_
->
format
(
msg
,
formatted
);
OutputDebugStringA
(
fmt
::
to_string
(
formatted
).
c_str
());
OutputDebugStringA
(
fmt
::
to_string
(
formatted
).
c_str
());
}
}
...
...
include/spdlog/sinks/ostream_sink.h
View file @
29f2eeea
...
@@ -26,7 +26,7 @@ protected:
...
@@ -26,7 +26,7 @@ protected:
void
sink_it_
(
const
details
::
log_msg
&
msg
)
override
void
sink_it_
(
const
details
::
log_msg
&
msg
)
override
{
{
fmt
::
memory_buffer
formatted
;
fmt
::
memory_buffer
formatted
;
sink
::
formatter_
->
format
(
msg
,
formatted
);
base_sink
<
Mutex
>
::
formatter_
->
format
(
msg
,
formatted
);
ostream_
.
write
(
formatted
.
data
(),
static_cast
<
std
::
streamsize
>
(
formatted
.
size
()));
ostream_
.
write
(
formatted
.
data
(),
static_cast
<
std
::
streamsize
>
(
formatted
.
size
()));
if
(
force_flush_
)
if
(
force_flush_
)
{
{
...
...
include/spdlog/sinks/rotating_file_sink-inl.h
View file @
29f2eeea
...
@@ -67,7 +67,7 @@ template<typename Mutex>
...
@@ -67,7 +67,7 @@ template<typename Mutex>
SPDLOG_INLINE
void
rotating_file_sink
<
Mutex
>::
sink_it_
(
const
details
::
log_msg
&
msg
)
SPDLOG_INLINE
void
rotating_file_sink
<
Mutex
>::
sink_it_
(
const
details
::
log_msg
&
msg
)
{
{
fmt
::
memory_buffer
formatted
;
fmt
::
memory_buffer
formatted
;
sink
::
formatter_
->
format
(
msg
,
formatted
);
base_sink
<
Mutex
>
::
formatter_
->
format
(
msg
,
formatted
);
current_size_
+=
formatted
.
size
();
current_size_
+=
formatted
.
size
();
if
(
current_size_
>
max_size_
)
if
(
current_size_
>
max_size_
)
{
{
...
...
include/spdlog/sinks/sink-inl.h
View file @
29f2eeea
...
@@ -10,14 +10,6 @@
...
@@ -10,14 +10,6 @@
#include "spdlog/common.h"
#include "spdlog/common.h"
#include "spdlog/details/pattern_formatter.h"
#include "spdlog/details/pattern_formatter.h"
SPDLOG_INLINE
spdlog
::
sinks
::
sink
::
sink
()
:
formatter_
{
details
::
make_unique
<
spdlog
::
pattern_formatter
>
()}
{}
SPDLOG_INLINE
spdlog
::
sinks
::
sink
::
sink
(
std
::
unique_ptr
<
spdlog
::
formatter
>
formatter
)
:
formatter_
{
std
::
move
(
formatter
)}
{}
SPDLOG_INLINE
bool
spdlog
::
sinks
::
sink
::
should_log
(
spdlog
::
level
::
level_enum
msg_level
)
const
SPDLOG_INLINE
bool
spdlog
::
sinks
::
sink
::
should_log
(
spdlog
::
level
::
level_enum
msg_level
)
const
{
{
return
msg_level
>=
level_
.
load
(
std
::
memory_order_relaxed
);
return
msg_level
>=
level_
.
load
(
std
::
memory_order_relaxed
);
...
@@ -25,7 +17,7 @@ SPDLOG_INLINE bool spdlog::sinks::sink::should_log(spdlog::level::level_enum msg
...
@@ -25,7 +17,7 @@ SPDLOG_INLINE bool spdlog::sinks::sink::should_log(spdlog::level::level_enum msg
SPDLOG_INLINE
void
spdlog
::
sinks
::
sink
::
set_level
(
level
::
level_enum
log_level
)
SPDLOG_INLINE
void
spdlog
::
sinks
::
sink
::
set_level
(
level
::
level_enum
log_level
)
{
{
level_
.
store
(
log_level
);
level_
.
store
(
log_level
,
std
::
memory_order_relaxed
);
}
}
SPDLOG_INLINE
spdlog
::
level
::
level_enum
spdlog
::
sinks
::
sink
::
level
()
const
SPDLOG_INLINE
spdlog
::
level
::
level_enum
spdlog
::
sinks
::
sink
::
level
()
const
...
...
include/spdlog/sinks/sink.h
View file @
29f2eeea
...
@@ -12,27 +12,19 @@ namespace sinks {
...
@@ -12,27 +12,19 @@ namespace sinks {
class
sink
class
sink
{
{
public
:
public
:
sink
();
explicit
sink
(
std
::
unique_ptr
<
spdlog
::
formatter
>
formatter
);
virtual
~
sink
()
=
default
;
virtual
~
sink
()
=
default
;
virtual
void
log
(
const
details
::
log_msg
&
msg
)
=
0
;
virtual
void
log
(
const
details
::
log_msg
&
msg
)
=
0
;
virtual
void
flush
()
=
0
;
virtual
void
flush
()
=
0
;
virtual
void
set_pattern
(
const
std
::
string
&
pattern
)
=
0
;
virtual
void
set_pattern
(
const
std
::
string
&
pattern
)
=
0
;
virtual
void
set_formatter
(
std
::
unique_ptr
<
spdlog
::
formatter
>
sink_formatter
)
=
0
;
virtual
void
set_formatter
(
std
::
unique_ptr
<
spdlog
::
formatter
>
sink_formatter
)
=
0
;
bool
should_log
(
level
::
level_enum
msg_level
)
const
;
void
set_level
(
level
::
level_enum
log_level
);
void
set_level
(
level
::
level_enum
log_level
);
level
::
level_enum
level
()
const
;
level
::
level_enum
level
()
const
;
bool
should_log
(
level
::
level_enum
msg_level
)
const
;
protected
:
protected
:
// sink log level - default is all
// sink log level - default is all
level_t
level_
{
level
::
trace
};
level_t
level_
{
level
::
trace
};
// sink formatter
std
::
unique_ptr
<
spdlog
::
formatter
>
formatter_
;
};
};
}
// namespace sinks
}
// namespace sinks
...
...
include/spdlog/sinks/stdout_sinks-inl.h
View file @
29f2eeea
...
@@ -18,6 +18,7 @@ template<typename ConsoleMutex>
...
@@ -18,6 +18,7 @@ template<typename ConsoleMutex>
SPDLOG_INLINE
stdout_sink_base
<
ConsoleMutex
>::
stdout_sink_base
(
FILE
*
file
)
SPDLOG_INLINE
stdout_sink_base
<
ConsoleMutex
>::
stdout_sink_base
(
FILE
*
file
)
:
mutex_
(
ConsoleMutex
::
mutex
())
:
mutex_
(
ConsoleMutex
::
mutex
())
,
file_
(
file
)
,
file_
(
file
)
,
formatter_
(
details
::
make_unique
<
spdlog
::
pattern_formatter
>
())
{}
{}
template
<
typename
ConsoleMutex
>
template
<
typename
ConsoleMutex
>
...
...
include/spdlog/sinks/stdout_sinks.h
View file @
29f2eeea
...
@@ -28,9 +28,10 @@ public:
...
@@ -28,9 +28,10 @@ public:
void
set_formatter
(
std
::
unique_ptr
<
spdlog
::
formatter
>
sink_formatter
)
override
;
void
set_formatter
(
std
::
unique_ptr
<
spdlog
::
formatter
>
sink_formatter
)
override
;
pr
ivate
:
pr
otected
:
mutex_t
&
mutex_
;
mutex_t
&
mutex_
;
FILE
*
file_
;
FILE
*
file_
;
std
::
unique_ptr
<
spdlog
::
formatter
>
formatter_
;
};
};
template
<
typename
ConsoleMutex
>
template
<
typename
ConsoleMutex
>
...
...
include/spdlog/sinks/syslog_sink.h
View file @
29f2eeea
...
@@ -52,7 +52,7 @@ protected:
...
@@ -52,7 +52,7 @@ protected:
if
(
enable_formatting_
)
if
(
enable_formatting_
)
{
{
fmt
::
memory_buffer
formatted
;
fmt
::
memory_buffer
formatted
;
sink
::
formatter_
->
format
(
msg
,
formatted
);
base_sink
<
Mutex
>
::
formatter_
->
format
(
msg
,
formatted
);
payload
=
string_view_t
(
formatted
.
data
(),
formatted
.
size
());
payload
=
string_view_t
(
formatted
.
data
(),
formatted
.
size
());
}
}
else
else
...
...
include/spdlog/sinks/wincolor_sink-inl.h
View file @
29f2eeea
...
@@ -8,14 +8,17 @@
...
@@ -8,14 +8,17 @@
#endif
#endif
#include "spdlog/common.h"
#include "spdlog/common.h"
#include "spdlog/details/pattern_formatter.h"
namespace
spdlog
{
namespace
spdlog
{
namespace
sinks
{
namespace
sinks
{
template
<
typename
ConsoleMutex
>
template
<
typename
ConsoleMutex
>
SPDLOG_INLINE
wincolor_sink
<
ConsoleMutex
>::
wincolor_sink
(
HANDLE
out_handle
,
color_mode
mode
)
SPDLOG_INLINE
wincolor_sink
<
ConsoleMutex
>::
wincolor_sink
(
HANDLE
out_handle
,
color_mode
mode
)
:
out_handle_
(
out_handle
)
:
,
out_handle_
(
out_handle
)
,
mutex_
(
ConsoleMutex
::
mutex
())
,
mutex_
(
ConsoleMutex
::
mutex
())
,
formatter_
(
details
::
make_unique
<
spdlog
::
pattern_formatter
>
())
{
{
set_color_mode
(
mode
);
set_color_mode
(
mode
);
colors_
[
level
::
trace
]
=
WHITE
;
colors_
[
level
::
trace
]
=
WHITE
;
...
...
include/spdlog/sinks/wincolor_sink.h
View file @
29f2eeea
...
@@ -45,11 +45,12 @@ public:
...
@@ -45,11 +45,12 @@ public:
void
set_formatter
(
std
::
unique_ptr
<
spdlog
::
formatter
>
sink_formatter
)
override
final
;
void
set_formatter
(
std
::
unique_ptr
<
spdlog
::
formatter
>
sink_formatter
)
override
final
;
void
set_color_mode
(
color_mode
mode
);
void
set_color_mode
(
color_mode
mode
);
pr
ivate
:
pr
otected
:
using
mutex_t
=
typename
ConsoleMutex
::
mutex_t
;
using
mutex_t
=
typename
ConsoleMutex
::
mutex_t
;
HANDLE
out_handle_
;
HANDLE
out_handle_
;
mutex_t
&
mutex_
;
mutex_t
&
mutex_
;
bool
should_do_colors_
;
bool
should_do_colors_
;
std
::
unique_ptr
<
spdlog
::
formatter
>
formatter_
;
std
::
unordered_map
<
level
::
level_enum
,
WORD
,
level
::
level_hasher
>
colors_
;
std
::
unordered_map
<
level
::
level_enum
,
WORD
,
level
::
level_hasher
>
colors_
;
// set color and return the orig console attributes (for resetting later)
// set color and return the orig console attributes (for resetting later)
...
...
tests/test_dup_filter.cpp
View file @
29f2eeea
...
@@ -5,14 +5,13 @@
...
@@ -5,14 +5,13 @@
using
namespace
spdlog
;
using
namespace
spdlog
;
using
namespace
spdlog
::
sinks
;
using
namespace
spdlog
::
sinks
;
TEST_CASE
(
"dup_filter_test1"
,
"[dup_filter_sink]"
)
TEST_CASE
(
"dup_filter_test1"
,
"[dup_filter_sink]"
)
{
{
dup_filter_sink_st
dup_sink
{
std
::
chrono
::
seconds
{
5
}};
dup_filter_sink_st
dup_sink
{
std
::
chrono
::
seconds
{
5
}};
auto
test_sink
=
std
::
make_shared
<
test_sink_mt
>
();
auto
test_sink
=
std
::
make_shared
<
test_sink_mt
>
();
dup_sink
.
add_sink
(
test_sink
);
dup_sink
.
add_sink
(
test_sink
);
for
(
int
i
=
0
;
i
<
10
;
i
++
)
for
(
int
i
=
0
;
i
<
10
;
i
++
)
{
{
dup_sink
.
log
(
spdlog
::
details
::
log_msg
{
"test"
,
spdlog
::
level
::
info
,
"message1"
});
dup_sink
.
log
(
spdlog
::
details
::
log_msg
{
"test"
,
spdlog
::
level
::
info
,
"message1"
});
}
}
...
@@ -22,11 +21,11 @@ TEST_CASE("dup_filter_test1", "[dup_filter_sink]")
...
@@ -22,11 +21,11 @@ TEST_CASE("dup_filter_test1", "[dup_filter_sink]")
TEST_CASE
(
"dup_filter_test2"
,
"[dup_filter_sink]"
)
TEST_CASE
(
"dup_filter_test2"
,
"[dup_filter_sink]"
)
{
{
dup_filter_sink_st
dup_sink
{
std
::
chrono
::
seconds
{
0
}};
dup_filter_sink_st
dup_sink
{
std
::
chrono
::
seconds
{
0
}};
auto
test_sink
=
std
::
make_shared
<
test_sink_mt
>
();
auto
test_sink
=
std
::
make_shared
<
test_sink_mt
>
();
dup_sink
.
add_sink
(
test_sink
);
dup_sink
.
add_sink
(
test_sink
);
for
(
int
i
=
0
;
i
<
10
;
i
++
)
for
(
int
i
=
0
;
i
<
10
;
i
++
)
{
{
dup_sink
.
log
(
spdlog
::
details
::
log_msg
{
"test"
,
spdlog
::
level
::
info
,
"message1"
});
dup_sink
.
log
(
spdlog
::
details
::
log_msg
{
"test"
,
spdlog
::
level
::
info
,
"message1"
});
}
}
...
@@ -36,11 +35,11 @@ TEST_CASE("dup_filter_test2", "[dup_filter_sink]")
...
@@ -36,11 +35,11 @@ TEST_CASE("dup_filter_test2", "[dup_filter_sink]")
TEST_CASE
(
"dup_filter_test3"
,
"[dup_filter_sink]"
)
TEST_CASE
(
"dup_filter_test3"
,
"[dup_filter_sink]"
)
{
{
dup_filter_sink_st
dup_sink
{
std
::
chrono
::
seconds
{
0
}};
dup_filter_sink_st
dup_sink
{
std
::
chrono
::
seconds
{
0
}};
auto
test_sink
=
std
::
make_shared
<
test_sink_mt
>
();
auto
test_sink
=
std
::
make_shared
<
test_sink_mt
>
();
dup_sink
.
add_sink
(
test_sink
);
dup_sink
.
add_sink
(
test_sink
);
for
(
int
i
=
0
;
i
<
10
;
i
++
)
for
(
int
i
=
0
;
i
<
10
;
i
++
)
{
{
dup_sink
.
log
(
spdlog
::
details
::
log_msg
{
"test"
,
spdlog
::
level
::
info
,
"message1"
});
dup_sink
.
log
(
spdlog
::
details
::
log_msg
{
"test"
,
spdlog
::
level
::
info
,
"message1"
});
dup_sink
.
log
(
spdlog
::
details
::
log_msg
{
"test"
,
spdlog
::
level
::
info
,
"message2"
});
dup_sink
.
log
(
spdlog
::
details
::
log_msg
{
"test"
,
spdlog
::
level
::
info
,
"message2"
});
...
@@ -51,7 +50,7 @@ TEST_CASE("dup_filter_test3", "[dup_filter_sink]")
...
@@ -51,7 +50,7 @@ TEST_CASE("dup_filter_test3", "[dup_filter_sink]")
TEST_CASE
(
"dup_filter_test4"
,
"[dup_filter_sink]"
)
TEST_CASE
(
"dup_filter_test4"
,
"[dup_filter_sink]"
)
{
{
dup_filter_sink_mt
dup_sink
{
std
::
chrono
::
milliseconds
{
10
}};
dup_filter_sink_mt
dup_sink
{
std
::
chrono
::
milliseconds
{
10
}};
auto
test_sink
=
std
::
make_shared
<
test_sink_mt
>
();
auto
test_sink
=
std
::
make_shared
<
test_sink_mt
>
();
dup_sink
.
add_sink
(
test_sink
);
dup_sink
.
add_sink
(
test_sink
);
...
@@ -63,7 +62,7 @@ TEST_CASE("dup_filter_test4", "[dup_filter_sink]")
...
@@ -63,7 +62,7 @@ TEST_CASE("dup_filter_test4", "[dup_filter_sink]")
TEST_CASE
(
"dup_filter_test5"
,
"[dup_filter_sink]"
)
TEST_CASE
(
"dup_filter_test5"
,
"[dup_filter_sink]"
)
{
{
dup_filter_sink_mt
dup_sink
{
std
::
chrono
::
seconds
{
5
}};
dup_filter_sink_mt
dup_sink
{
std
::
chrono
::
seconds
{
5
}};
auto
test_sink
=
std
::
make_shared
<
test_sink_mt
>
();
auto
test_sink
=
std
::
make_shared
<
test_sink_mt
>
();
dup_sink
.
add_sink
(
test_sink
);
dup_sink
.
add_sink
(
test_sink
);
...
@@ -74,4 +73,3 @@ TEST_CASE("dup_filter_test5", "[dup_filter_sink]")
...
@@ -74,4 +73,3 @@ TEST_CASE("dup_filter_test5", "[dup_filter_sink]")
REQUIRE
(
test_sink
->
msg_counter
()
==
3
);
// skip 2 messages but log the "skipped.." message before message2
REQUIRE
(
test_sink
->
msg_counter
()
==
3
);
// skip 2 messages but log the "skipped.." message before message2
}
}
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