Skip to content

Commit

Permalink
support bool
Browse files Browse the repository at this point in the history
  • Loading branch information
qicosmos committed Aug 15, 2023
1 parent 0bbb225 commit 36b842b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
4 changes: 4 additions & 0 deletions include/ylt/easylog/record.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,11 @@ class record_t {
const auto end = jkj::dragonbox::to_chars(data, temp);
ss_.append(temp, std::distance(temp, end));
}
else if constexpr (std::is_same_v<bool, U>) {
data ? ss_.append("true") : ss_.append("false");
}
else if constexpr (std::is_same_v<char, U>) {
data ? ss_.append("true") : ss_.append("false");
ss_.push_back(data);
}
else if constexpr (std::is_enum_v<U>) {
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 @@ -41,6 +41,7 @@ TEST_CASE("test basic") {
std::unique_ptr<int> ptr(new int(42));
ELOG_INFO << ptr.get();
ELOG_INFO << 42 << " " << 4.5 << 'a' << Severity::DEBUG;
ELOG_INFO << false << ", " << true;

ELOGV(INFO, "test");
ELOGV(INFO, "it is a long string test %d %s", 2, "ok");
Expand Down

0 comments on commit 36b842b

Please sign in to comment.