summaryrefslogtreecommitdiff
path: root/asl/logging/logging_tests.cpp
diff options
context:
space:
mode:
authorSteven Le Rouzic <steven.lerouzic@gmail.com>2025-02-12 23:34:47 +0100
committerSteven Le Rouzic <steven.lerouzic@gmail.com>2025-02-12 23:34:47 +0100
commitcb77cbe9ce4cddad6a460aa190ff70f0c13e4703 (patch)
treeeb63a44f6264893ba803ff27db2faa59d644b0e9 /asl/logging/logging_tests.cpp
parente297b4182b735d97d5251361854acd2fccb03013 (diff)
Rename log to logging
Diffstat (limited to 'asl/logging/logging_tests.cpp')
-rw-r--r--asl/logging/logging_tests.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/asl/logging/logging_tests.cpp b/asl/logging/logging_tests.cpp
new file mode 100644
index 0000000..ebbf800
--- /dev/null
+++ b/asl/logging/logging_tests.cpp
@@ -0,0 +1,23 @@
+#include "asl/logging/logging.hpp"
+#include "asl/testing/testing.hpp"
+#include "asl/string_builder.hpp"
+
+ASL_TEST(log)
+{
+ asl::log::log(asl::log::kInfo, asl::source_location{}, "Hello, {}!", "world"_sv);
+
+ 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/logging/logging_tests.cpp:18: Hello\n");
+}
+