Skip to content

Commit

Permalink
allow single arg (#632)
Browse files Browse the repository at this point in the history
  • Loading branch information
qicosmos authored Mar 18, 2024
1 parent 06d28e6 commit ba4685d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
4 changes: 2 additions & 2 deletions include/ylt/easylog.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -231,15 +231,15 @@ inline void add_appender(std::function<void(std::string_view)> fn) {

#if __has_include(<fmt/format.h>) || __has_include(<format>)

#define ELOGFMT_IMPL0(severity, Id, prefix, format_str, ...) \
#define ELOGFMT_IMPL0(severity, Id, prefix, ...) \
if (!easylog::logger<Id>::instance().check_severity(severity)) { \
; \
} \
else { \
easylog::logger<Id>::instance() += \
easylog::record_t(std::chrono::system_clock::now(), severity, \
GET_STRING(__FILE__, __LINE__)) \
.format(prefix::format(format_str, __VA_ARGS__)); \
.format(prefix::format(__VA_ARGS__)); \
if constexpr (severity == easylog::Severity::CRITICAL) { \
easylog::flush<Id>(); \
std::exit(EXIT_FAILURE); \
Expand Down
1 change: 1 addition & 0 deletions src/easylog/tests/test_easylog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ TEST_CASE("test basic") {
ELOG_INFO << buf << ", " << str << ", " << sv << ", " << id;

#if __has_include(<fmt/format.h>) || (__has_include(<format>) && !defined(__APPLE__))
ELOGFMT(INFO, "Hello");
ELOGFMT(INFO, "{} {}", 20, 42);
ELOGFMT(INFO, "it is a long string test {} {}", 42, "fmt");
#endif
Expand Down

0 comments on commit ba4685d

Please sign in to comment.