|
Porytiles
|
Concrete implementation of UserDiagnostics that outputs structured messages to stderr, optionally with colored formatting. More...
#include <stderr_styled_user_diagnostics.hpp>
Public Member Functions | |
| StderrStyledUserDiagnostics (const gsl::not_null< TextFormatter * > format) | |
| void | remark (const std::string &tag, const std::vector< std::string > &lines) const override |
| Display a multi-line tagged informational remark to stderr. | |
| void | warning (const std::string &tag, const std::vector< std::string > &lines) const override |
| Display a multi-line tagged warning to stderr. | |
| void | error (const std::string &tag, const std::vector< std::string > &lines) const override |
| Display a multi-line tagged error message to stderr. | |
| void | emit_fatal_proximate (const Error &err) const override |
| Emit the proximate (immediate) error in a fatal error chain to stderr. | |
| void | emit_fatal_step (const Error &err) const override |
| Emit an intermediate step error in a fatal error chain to stderr. | |
| void | emit_fatal_root (const Error &err) const override |
| Emit the root cause error in a fatal error chain to stderr. | |
| void | remark_note (const std::string &tag, const std::vector< std::string > &lines) const override |
| Display a multi-line tagged note associated with a remark to stderr. | |
| void | warning_note (const std::string &tag, const std::vector< std::string > &lines) const override |
| Display a multi-line tagged note associated with a warning to stderr. | |
| void | error_note (const std::string &tag, const std::vector< std::string > &lines) const override |
| Display a multi-line tagged note associated with an error to stderr. | |
Public Member Functions inherited from porytiles::UserDiagnostics | |
| virtual | ~UserDiagnostics ()=default |
| UserDiagnostics (gsl::not_null< const TextFormatter * > format) | |
| void | remark (const std::string &tag, const std::string &msg) const |
| Convenience overload for single line messages. | |
| template<typename FirstParam , typename... RestParams> requires ( !std::is_same_v<std::decay_t<FirstParam>, std::vector<FormatParam>> && std::is_constructible_v<FormatParam, FirstParam> && (std::is_constructible_v<FormatParam, RestParams> && ...)) | |
| void | remark (const std::string &tag, const std::string &format_str, FirstParam &&first, RestParams &&...rest) const |
| Variadic template overload for formatted remark messages. | |
| void | warning (const std::string &tag, const std::string &msg) const |
| Convenience overload for single line messages. | |
| template<typename FirstParam , typename... RestParams> requires ( !std::is_same_v<std::decay_t<FirstParam>, std::vector<FormatParam>> && std::is_constructible_v<FormatParam, FirstParam> && (std::is_constructible_v<FormatParam, RestParams> && ...)) | |
| void | warning (const std::string &tag, const std::string &format_str, FirstParam &&first, RestParams &&...rest) const |
| Variadic template overload for formatted warning messages. | |
| void | error (const std::string &tag, const std::string &msg) const |
| Convenience overload for single line messages. | |
| template<typename FirstParam , typename... RestParams> requires ( !std::is_same_v<std::decay_t<FirstParam>, std::vector<FormatParam>> && std::is_constructible_v<FormatParam, FirstParam> && (std::is_constructible_v<FormatParam, RestParams> && ...)) | |
| void | error (const std::string &tag, const std::string &format_str, FirstParam &&first, RestParams &&...rest) const |
| Variadic template overload for formatted error messages. | |
| void | remark_note (const std::string &tag, const std::string &msg) const |
| Convenience overload for single line messages. | |
| template<typename FirstParam , typename... RestParams> requires ( !std::is_same_v<std::decay_t<FirstParam>, std::vector<FormatParam>> && std::is_constructible_v<FormatParam, FirstParam> && (std::is_constructible_v<FormatParam, RestParams> && ...)) | |
| void | remark_note (const std::string &tag, const std::string &format_str, FirstParam &&first, RestParams &&...rest) const |
| Variadic template overload for formatted remark note messages. | |
| void | warning_note (const std::string &tag, const std::string &msg) const |
| Convenience overload for single line messages. | |
| template<typename FirstParam , typename... RestParams> requires ( !std::is_same_v<std::decay_t<FirstParam>, std::vector<FormatParam>> && std::is_constructible_v<FormatParam, FirstParam> && (std::is_constructible_v<FormatParam, RestParams> && ...)) | |
| void | warning_note (const std::string &tag, const std::string &format_str, FirstParam &&first, RestParams &&...rest) const |
| Variadic template overload for formatted warning note messages. | |
| void | error_note (const std::string &tag, const std::string &msg) const |
| Convenience overload for single line messages. | |
| template<typename FirstParam , typename... RestParams> requires ( !std::is_same_v<std::decay_t<FirstParam>, std::vector<FormatParam>> && std::is_constructible_v<FormatParam, FirstParam> && (std::is_constructible_v<FormatParam, RestParams> && ...)) | |
| void | error_note (const std::string &tag, const std::string &format_str, FirstParam &&first, RestParams &&...rest) const |
| Variadic template overload for formatted error note messages. | |
| template<typename T , typename E > | |
| void | fatal (const ChainableResult< T, E > &result) const |
| Display a fatal error with complete error chain visualization. | |
| const TextFormatter & | formatter () const |
Concrete implementation of UserDiagnostics that outputs structured messages to stderr, optionally with colored formatting.
StderrStyledUserDiagnostics provides a terminal-based implementation of the UserDiagnostics interface. It outputs all diagnostic messages to stderr with some additional pretty-print structuring. If provided with an AnsiStyledTextFormatter, it will additionally use canonical diagnostic coloring and styling (canonical, i.e. magenta for warnings, red for errors, bolding where appropriate, etc.) via ANSI terminal codes. The implementation includes:
Definition at line 30 of file stderr_styled_user_diagnostics.hpp.
|
inlineexplicit |
Definition at line 32 of file stderr_styled_user_diagnostics.hpp.
|
overridevirtual |
Emit the proximate (immediate) error in a fatal error chain to stderr.
Displays the most immediate error in a fatal error chain with red "fatal:" prefix and the highest visual prominence. This represents the direct cause of the failure.
| err | The proximate error to display |
Implements porytiles::UserDiagnostics.
Definition at line 59 of file stderr_styled_user_diagnostics.cpp.
|
overridevirtual |
Emit the root cause error in a fatal error chain to stderr.
Displays the root cause error in a fatal error chain using tree-like formatting with Unicode box-drawing characters (└ symbols). This represents the original underlying cause of the failure and appears as the final item in the error hierarchy visualization.
| err | The root cause error to display |
Implements porytiles::UserDiagnostics.
Definition at line 87 of file stderr_styled_user_diagnostics.cpp.
|
overridevirtual |
Emit an intermediate step error in a fatal error chain to stderr.
Displays intermediate errors in a fatal error chain using tree-like formatting with Unicode box-drawing characters (├ symbols). These represent the intermediate causes between the proximate and root errors in the failure chain.
| err | The step error to display |
Implements porytiles::UserDiagnostics.
Definition at line 72 of file stderr_styled_user_diagnostics.cpp.
|
overridevirtual |
Display a multi-line tagged error message to stderr.
Outputs error messages with red "error:" prefix and tag suffix on the first line, formatted as "error: <message> [<tag>]" with appropriate indentation for subsequent lines.
| tag | Categorization tag for the error |
| lines | Vector of strings representing each line of the error |
Implements porytiles::UserDiagnostics.
Definition at line 44 of file stderr_styled_user_diagnostics.cpp.
|
overridevirtual |
Display a multi-line tagged note associated with an error to stderr.
Outputs informational messages with cyan "note:" prefix and tag suffix on the first line, formatted as "note: <message> [<tag>]" with appropriate indentation for subsequent lines. Uses identical styling to remark_note and warning_note since notes are informational regardless of parent diagnostic type.
| tag | Categorization tag for the note (should match the parent error's tag) |
| lines | Vector of strings representing each line of the note |
Implements porytiles::UserDiagnostics.
Definition at line 112 of file stderr_styled_user_diagnostics.cpp.
|
overridevirtual |
Display a multi-line tagged informational remark to stderr.
Outputs informational messages with blue "remark:" prefix and tag suffix on the first line, formatted as "remark: <message> [<tag>]" with appropriate indentation for subsequent lines.
| tag | Categorization tag for the remark |
| lines | Vector of strings representing each line of the remark |
Implements porytiles::UserDiagnostics.
Definition at line 13 of file stderr_styled_user_diagnostics.cpp.
|
overridevirtual |
Display a multi-line tagged note associated with a remark to stderr.
Outputs informational messages with cyan "note:" prefix and tag suffix on the first line, formatted as "note: <message> [<tag>]" with appropriate indentation for subsequent lines. Uses identical styling to warning_note and error_note since notes are informational regardless of parent diagnostic type.
| tag | Categorization tag for the note (should match the parent remark's tag) |
| lines | Vector of strings representing each line of the note |
Implements porytiles::UserDiagnostics.
Definition at line 102 of file stderr_styled_user_diagnostics.cpp.
|
overridevirtual |
Display a multi-line tagged warning to stderr.
Outputs warnings with magenta "warning:" prefix and tag suffix on the first line, formatted as "warning: <message> [<tag>]" with appropriate indentation for subsequent lines.
| tag | Categorization tag for the warning |
| lines | Vector of strings representing each line of the warning |
Implements porytiles::UserDiagnostics.
Definition at line 28 of file stderr_styled_user_diagnostics.cpp.
|
overridevirtual |
Display a multi-line tagged note associated with a warning to stderr.
Outputs informational messages with cyan "note:" prefix and tag suffix on the first line, formatted as "note: <message> [<tag>]" with appropriate indentation for subsequent lines. Uses identical styling to remark_note and error_note since notes are informational regardless of parent diagnostic type.
| tag | Categorization tag for the note (should match the parent warning's tag) |
| lines | Vector of strings representing each line of the note |
Implements porytiles::UserDiagnostics.
Definition at line 107 of file stderr_styled_user_diagnostics.cpp.