diff options
author | Steven Le Rouzic <steven.lerouzic@gmail.com> | 2025-02-04 00:37:08 +0100 |
---|---|---|
committer | Steven Le Rouzic <steven.lerouzic@gmail.com> | 2025-02-04 00:37:08 +0100 |
commit | 3d5a45b283d2a59211f9e24f100b95169375213d (patch) | |
tree | 2180c31100324076f7ff862009190564c0296b58 /asl/log/log_tests.cpp | |
parent | f2b1af8d3f23ff47b343cef8feef6e25ff5377e4 (diff) |
Add deref utilities & use them for log writer
Diffstat (limited to 'asl/log/log_tests.cpp')
-rw-r--r-- | asl/log/log_tests.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/asl/log/log_tests.cpp b/asl/log/log_tests.cpp index 01e8fd7..4ab83e8 100644 --- a/asl/log/log_tests.cpp +++ b/asl/log/log_tests.cpp @@ -1,5 +1,6 @@ #include <asl/log/log.hpp> #include <asl/testing/testing.hpp> +#include <asl/string_builder.hpp> ASL_TEST(log) { @@ -8,3 +9,15 @@ ASL_TEST(log) ASL_LOG_ERROR("Oh no! {}", 42); } +static asl::StringWriter g_string_writer{}; + +ASL_TEST(custom_writer) +{ + asl::log::register_logger<asl::log::DefaultLogger<asl::StringWriter<>&>>(g_string_writer); + + ASL_LOG_INFO("Hello"); + auto sv = g_string_writer.as_string_view(); + + ASL_TEST_EXPECT(sv == "[ INFO ] asl/log/log_tests.cpp:18: Hello\n"); +} + |