4#include "../Strings/StringFormat.h"
32 template <
typename... Types>
35 return printInternal(
true, fmt, forward<Types>(args)...);
40 template <
typename... Types>
43 return printInternal(
false, fmt, forward<Types>(args)...);
69 template <
typename... Types>
70 bool printInternal(
bool useStdOut,
StringSpan fmt, Types&&... args)
81 Span<char> conversionBuffer;
82#if SC_PLATFORM_WINDOWS
83 void printWindows(
const StringSpan str,
void* handle);
87 bool isConsole =
true;
88 bool isDebugger =
true;
96#if !defined(SC_LOG_MESSAGE)
97#define SC_LOG_MESSAGE(fmt, ...) \
99 globalConsole->print(fmt, ##__VA_ARGS__)
Writes to console using SC::StringFormat.
Definition Console.h:25
void flush()
Flushes stdout.
void print(const StringSpan str)
Prints a string to console.
void printLine(const StringSpan str)
Prints a string to stdout and adds a newline at the end of it.
void flushStdErr()
Flushes stderr.
void printError(const StringSpan str)
Prints a string to stderr.
bool print(StringSpan fmt, Types &&... args)
Prints a formatted string using SC::StringFormat to stdout.
Definition Console.h:33
bool printError(StringSpan fmt, Types &&... args)
Prints a formatted string using SC::StringFormat to stderr.
Definition Console.h:41
void printErrorLine(const StringSpan str)
Prints a string to stderr and adds a newline at the end of it.
static bool tryAttachingToParentConsole()
Tries attaching current process to parent console (Windows only, has no effect elsewhere)
Console(Span< char > conversionBuffer={})
Constructs a console with an OPTIONAL conversion buffer used for UTF encoding conversions on Windows.
View over a contiguous sequence of items (pointer + size in elements).
Definition Span.h:29
An read-only view over a string (to avoid including Strings library when parsing is not needed).
Definition StringSpan.h:37
constexpr StringEncoding getEncoding() const
Get encoding of this StringView.
Definition StringSpan.h:98