diff options
author | Steven Le Rouzic <steven.lerouzic@gmail.com> | 2024-10-11 00:32:49 +0200 |
---|---|---|
committer | Steven Le Rouzic <steven.lerouzic@gmail.com> | 2024-12-20 15:35:58 +0100 |
commit | f011d871ef3af26c8f4e19de2c8d781c601ceffb (patch) | |
tree | ac3611e6fa054cc0f8870aad524b263ff917057f /asl/print.hpp | |
parent | e020805cb140ed98d09e606a867b910fce78ad15 (diff) |
Add console printing
Diffstat (limited to 'asl/print.hpp')
-rw-r--r-- | asl/print.hpp | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/asl/print.hpp b/asl/print.hpp new file mode 100644 index 0000000..d82d52b --- /dev/null +++ b/asl/print.hpp @@ -0,0 +1,31 @@ +#pragma once
+
+#include "asl/format.hpp"
+
+namespace asl
+{
+
+namespace print_internals
+{
+
+// @Todo Make print writers thread safe
+writer* get_stdout_writer();
+writer* get_stderr_writer();
+
+} // namespace print_internals
+
+// @Todo Use string_view
+template<formattable... Args>
+void print(const char* fmt, const Args&... args)
+{
+ format(print_internals::get_stdout_writer(), fmt, args...);
+}
+
+// @Todo Use string_view
+template<formattable... Args>
+void eprint(const char* fmt, const Args&... args)
+{
+ format(print_internals::get_stderr_writer(), fmt, args...);
+}
+
+} // namespace asl
|