4
4
5
5
#include < stdx/ct_format.hpp>
6
6
#include < stdx/ct_string.hpp>
7
+ #include < stdx/span.hpp>
7
8
8
9
#include < conc/concurrency.hpp>
9
10
@@ -15,10 +16,11 @@ int log_calls{};
15
16
std::uint32_t last_header{};
16
17
17
18
namespace {
18
- struct test_log_args_destination {
19
- auto log_by_args (std::uint32_t hdr, auto ...) -> void {
19
+ struct test_log_destination {
20
+ template <std::size_t N>
21
+ auto operator ()(stdx::span<std::uint32_t const , N> pkt) const {
20
22
++log_calls;
21
- last_header = hdr ;
23
+ last_header = pkt[ 0 ] ;
22
24
}
23
25
};
24
26
@@ -36,40 +38,40 @@ auto log_with_fixed_string_id() -> void;
36
38
auto log_with_fixed_module_id () -> void;
37
39
38
40
auto log_zero_args () -> void {
39
- auto cfg = logging::binary::config{test_log_args_destination {}};
41
+ auto cfg = logging::binary::config{test_log_destination {}};
40
42
cfg.logger .log_msg <log_env1>(
41
43
stdx::ct_format<" A string with no placeholders" >());
42
44
}
43
45
44
46
auto log_one_ct_arg () -> void {
45
47
using namespace stdx ::literals;
46
- auto cfg = logging::binary::config{test_log_args_destination {}};
48
+ auto cfg = logging::binary::config{test_log_destination {}};
47
49
cfg.logger .log_msg <log_env1>(
48
50
stdx::ct_format<" B string with {} placeholder" >(" one" _ctst));
49
51
}
50
52
51
53
auto log_one_32bit_rt_arg () -> void {
52
- auto cfg = logging::binary::config{test_log_args_destination {}};
54
+ auto cfg = logging::binary::config{test_log_destination {}};
53
55
cfg.logger .log_msg <log_env1>(
54
56
stdx::ct_format<" C1 string with {} placeholder" >(std::int32_t {1 }));
55
57
}
56
58
57
59
auto log_one_64bit_rt_arg () -> void {
58
- auto cfg = logging::binary::config{test_log_args_destination {}};
60
+ auto cfg = logging::binary::config{test_log_destination {}};
59
61
cfg.logger .log_msg <log_env1>(
60
62
stdx::ct_format<" C2 string with {} placeholder" >(std::int64_t {1 }));
61
63
}
62
64
63
65
auto log_one_formatted_rt_arg () -> void {
64
- auto cfg = logging::binary::config{test_log_args_destination {}};
66
+ auto cfg = logging::binary::config{test_log_destination {}};
65
67
cfg.logger .log_msg <log_env1>(
66
68
stdx::ct_format<" C3 string with {:08x} placeholder" >(std::int32_t {1 }));
67
69
}
68
70
69
71
auto log_with_non_default_module () -> void {
70
72
CIB_WITH_LOG_ENV (logging::get_level, logging::level::TRACE,
71
73
logging::get_module, " not default" ) {
72
- auto cfg = logging::binary::config{test_log_args_destination {}};
74
+ auto cfg = logging::binary::config{test_log_destination {}};
73
75
cfg.logger .log_msg <cib_log_env_t >(
74
76
stdx::ct_format<" ModuleID string with {} placeholder" >(1 ));
75
77
}
@@ -78,7 +80,7 @@ auto log_with_non_default_module() -> void {
78
80
auto log_with_fixed_module () -> void {
79
81
CIB_WITH_LOG_ENV (logging::get_level, logging::level::TRACE,
80
82
logging::get_module, " fixed" ) {
81
- auto cfg = logging::binary::config{test_log_args_destination {}};
83
+ auto cfg = logging::binary::config{test_log_destination {}};
82
84
cfg.logger .log_msg <cib_log_env_t >(
83
85
stdx::ct_format<" Fixed ModuleID string with {} placeholder" >(1 ));
84
86
}
@@ -87,7 +89,7 @@ auto log_with_fixed_module() -> void {
87
89
auto log_with_fixed_string_id () -> void {
88
90
CIB_WITH_LOG_ENV (logging::get_level, logging::level::TRACE,
89
91
logging::get_string_id, 1337 ) {
90
- auto cfg = logging::binary::config{test_log_args_destination {}};
92
+ auto cfg = logging::binary::config{test_log_destination {}};
91
93
cfg.logger .log_msg <cib_log_env_t >(
92
94
stdx::ct_format<" Fixed StringID string" >());
93
95
}
@@ -97,7 +99,7 @@ auto log_with_fixed_module_id() -> void {
97
99
CIB_WITH_LOG_ENV (logging::get_level, logging::level::TRACE,
98
100
logging::get_module_id, 7 , logging::get_module,
99
101
" fixed_id" ) {
100
- auto cfg = logging::binary::config{test_log_args_destination {}};
102
+ auto cfg = logging::binary::config{test_log_destination {}};
101
103
cfg.logger .log_msg <cib_log_env_t >(
102
104
stdx::ct_format<" Fixed ModuleID string with {} placeholder" >(1 ));
103
105
}
0 commit comments