-
I created this minimal example: struct my_logger_config : logging::null::config
{
struct
{
template <logging::level L, typename... Ts>
constexpr auto log(Ts &&...args) const noexcept -> void
{
std::puts(std::forward<Ts>(args)...);
}
} logger;
static auto terminate() noexcept -> void
{
//do something maybe reset?
}
};
template <>
inline auto logging::config<> = my_logger_config{};
void testFunc(void)
{
CIB_INFO("Hello World");
} Has someone a clue how to call std::puts on this? Compiler says: too many arguments to function ‘int puts(const char*)’GCC
cib.hpp(26, 16): In instantiation of ‘constexpr void my_logger_config::<unnamed struct>::log(Ts&& ...) const [with logging::level L = logging::INFO; Ts = {const char (&)[73], int, sc::lazy_string_format<sc::string_constant<char, 'H', 'e', 'l', 'l', 'o', ' ', 'W', 'o', 'r', 'l', 'd'>, cib::tuple_impl<> >}]’: |
Beta Was this translation helpful? Give feedback.
Answered by
elbeno
Jun 26, 2024
Replies: 1 comment 1 reply
-
See how the fmt logger does it: https://github.com/intel/compile-time-init-build/blob/cpp17/include/log/fmt/logger.hpp#L29 That pack of Ts... contains several arguments:
|
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
tunguskar
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
See how the fmt logger does it: https://github.com/intel/compile-time-init-build/blob/cpp17/include/log/fmt/logger.hpp#L29
That pack of Ts... contains several arguments:
Ts = {const char (&)[73], int, sc::lazy_string_format<sc::string_constant<char, 'H', 'e', 'l', 'l', 'o', ' ', 'W', 'o', 'r', 'l', 'd'>, cib::tuple_impl<> >}
const char (&)[73]
is__FILE__
int
is__LINE__
sc::lazy_string_format<sc::string_constant<char, 'H', 'e', 'l', 'l', 'o', ' ', 'W', 'o', 'r', 'l', 'd'>, cib::tuple_impl<> >
is the format string and any runtime arguments to put into it (in this case none)puts
isn't going to handle this in general (other than possibly outputting the__FILE__
and the format string unal…