Console output with color and formatting support.
More...
#include <Console.hpp>
|
| | Console () |
| bool | IsTerminal () const |
| | Check if stdout is a terminal (supports ANSI codes).
|
| void | SetColorEnabled (bool enabled) |
| | Enable/disable color output (auto-detected by default).
|
| bool | IsColorEnabled () const |
| void | SetLogLevel (LogLevel level) |
| | Set minimum log level for output.
|
| LogLevel | GetLogLevel () const |
| void | Trace (std::string_view msg) |
| void | Debug (std::string_view msg) |
| void | Info (std::string_view msg) |
| void | Event (std::string_view msg) |
| void | Warning (std::string_view msg) |
| void | Error (std::string_view msg) |
| void | Fatal (std::string_view msg) |
| void | Log (LogLevel level, std::string_view msg) |
| | Log with explicit level.
|
| void | LogTimed (LogLevel level, double sim_time, std::string_view msg) |
| | Log with timestamp prefix.
|
| std::string | Colorize (std::string_view text, const char *color) const |
| | Apply color if enabled.
|
| std::string | HorizontalRule (int width=80, char c='-') const |
| | Create horizontal rule.
|
| std::string | BoxHorizontalRule (int width=80) const |
| | Create horizontal rule with box-drawing character.
|
| void | Write (std::string_view text) const |
| | Write raw string (no formatting).
|
| void | WriteLine (std::string_view text="") const |
| | Write raw string with newline.
|
| void | Flush () const |
| | Flush output.
|
|
| static std::string | PadRight (std::string_view text, std::size_t width) |
| | Pad string to width (right-aligned).
|
| static std::string | PadLeft (std::string_view text, std::size_t width) |
| | Pad string to width (left-aligned).
|
| static std::string | PadCenter (std::string_view text, std::size_t width) |
| | Pad string to width (center-aligned).
|
| static std::string | FormatNumber (double value, int precision=2) |
| | Format number with fixed precision.
|
Console output with color and formatting support.
Detects if stdout is a terminal and enables/disables ANSI colors accordingly.
◆ Console()
| icarus::Console::Console |
( |
| ) |
|
|
inline |
◆ BoxHorizontalRule()
| std::string icarus::Console::BoxHorizontalRule |
( |
int | width = 80 | ) |
const |
|
inlinenodiscard |
Create horizontal rule with box-drawing character.
◆ Colorize()
| std::string icarus::Console::Colorize |
( |
std::string_view | text, |
|
|
const char * | color ) const |
|
inlinenodiscard |
◆ Debug()
| void icarus::Console::Debug |
( |
std::string_view | msg | ) |
|
|
inline |
◆ Error()
| void icarus::Console::Error |
( |
std::string_view | msg | ) |
|
|
inline |
◆ Event()
| void icarus::Console::Event |
( |
std::string_view | msg | ) |
|
|
inline |
◆ Fatal()
| void icarus::Console::Fatal |
( |
std::string_view | msg | ) |
|
|
inline |
◆ Flush()
| void icarus::Console::Flush |
( |
| ) |
const |
|
inline |
◆ FormatNumber()
| std::string icarus::Console::FormatNumber |
( |
double | value, |
|
|
int | precision = 2 ) |
|
inlinestaticnodiscard |
Format number with fixed precision.
◆ GetLogLevel()
| LogLevel icarus::Console::GetLogLevel |
( |
| ) |
const |
|
inlinenodiscard |
◆ HorizontalRule()
| std::string icarus::Console::HorizontalRule |
( |
int | width = 80, |
|
|
char | c = '-' ) const |
|
inlinenodiscard |
◆ Info()
| void icarus::Console::Info |
( |
std::string_view | msg | ) |
|
|
inline |
◆ IsColorEnabled()
| bool icarus::Console::IsColorEnabled |
( |
| ) |
const |
|
inlinenodiscard |
◆ IsTerminal()
| bool icarus::Console::IsTerminal |
( |
| ) |
const |
|
inlinenodiscard |
Check if stdout is a terminal (supports ANSI codes).
◆ Log()
| void icarus::Console::Log |
( |
LogLevel | level, |
|
|
std::string_view | msg ) |
|
inline |
◆ LogTimed()
| void icarus::Console::LogTimed |
( |
LogLevel | level, |
|
|
double | sim_time, |
|
|
std::string_view | msg ) |
|
inline |
Log with timestamp prefix.
◆ PadCenter()
| std::string icarus::Console::PadCenter |
( |
std::string_view | text, |
|
|
std::size_t | width ) |
|
inlinestaticnodiscard |
Pad string to width (center-aligned).
◆ PadLeft()
| std::string icarus::Console::PadLeft |
( |
std::string_view | text, |
|
|
std::size_t | width ) |
|
inlinestaticnodiscard |
Pad string to width (left-aligned).
◆ PadRight()
| std::string icarus::Console::PadRight |
( |
std::string_view | text, |
|
|
std::size_t | width ) |
|
inlinestaticnodiscard |
Pad string to width (right-aligned).
◆ SetColorEnabled()
| void icarus::Console::SetColorEnabled |
( |
bool | enabled | ) |
|
|
inline |
Enable/disable color output (auto-detected by default).
◆ SetLogLevel()
| void icarus::Console::SetLogLevel |
( |
LogLevel | level | ) |
|
|
inline |
Set minimum log level for output.
◆ Trace()
| void icarus::Console::Trace |
( |
std::string_view | msg | ) |
|
|
inline |
◆ Warning()
| void icarus::Console::Warning |
( |
std::string_view | msg | ) |
|
|
inline |
◆ Write()
| void icarus::Console::Write |
( |
std::string_view | text | ) |
const |
|
inline |
Write raw string (no formatting).
◆ WriteLine()
| void icarus::Console::WriteLine |
( |
std::string_view | text = "" | ) |
const |
|
inline |
Write raw string with newline.
The documentation for this class was generated from the following file: