86 #include <string_view>
89 #include "../base/macros.h"
110 static constexpr
size_t kDefaultBufferSize{1024 * 1024 * 1};
169 void init() noexcept;
176 [[nodiscard]]
bool is_tty() const noexcept;
183 [[nodiscard]]
bool is_initialized() const noexcept;
313 static
int default_stdout_fd() noexcept;
315 void flush_unlocked() noexcept;
317 void write_to_buffer(const
char* data,
size_t len) noexcept;
320 TerminalStream& write_unsigned(
unsigned long long value) noexcept;
325 std::atomic_bool initialized_{
false};
326 std::atomic_bool is_tty_{
false};
328 mutable std::mutex mutex_;
329 std::vector<char> buffer_;
330 size_t write_pos_{0};
331 int fd_{default_stdout_fd()};
336 #ifndef VLINK_TERM_OUT
337 #define VLINK_TERM_OUT vlink::TerminalStream::get()
Process-wide buffered stdout writer with TTY detection, ANSI support, and a 1 MiB ring.
Definition: terminal_stream.h:101
static TerminalStream & get() noexcept
Returns the process-wide singleton, building it on the first call.
TerminalStream &(*)(TerminalStream &) ManipType
Function-pointer type accepted by operator<<(ManipType) for custom manipulators.
Definition: terminal_stream.h:115
#define VLINK_EXPORT
Definition: macros.h:81