Add console printing

This commit is contained in:
2024-10-11 00:32:49 +02:00
parent e020805cb1
commit f011d871ef
7 changed files with 118 additions and 25 deletions

31
asl/print.hpp Normal file
View File

@ -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