4#include "../Strings/StringFormat.h"
5#include "StringsExport.h"
33 template <
typename... Types>
36 return printInternal(
true, fmt, forward<Types>(args)...);
41 template <
typename... Types>
44 return printInternal(
false, fmt, forward<Types>(args)...);
70 template <
typename... Types>
71 bool printInternal(
bool useStdOut,
StringSpan fmt, Types&&... args)
82 Span<char> conversionBuffer;
83#if SC_PLATFORM_WINDOWS
84 void printWindows(
const StringSpan str,
void* handle);
88 bool isConsole =
true;
89 bool isDebugger =
true;
97#if !defined(SC_LOG_MESSAGE)
98#define SC_LOG_MESSAGE(fmt, ...) \
100 globalConsole->print(fmt, ##__VA_ARGS__)
Writes to console using SC::StringFormat.
Definition Console.h:26
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:34
bool printError(StringSpan fmt, Types &&... args)
Prints a formatted string using SC::StringFormat to stderr.
Definition Console.h:42
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