|
Uni20
Asynchronous tensor and runtime library.
|
Configuration and formatting options for a trace module. More...
#include <trace_impl.hpp>
Classes | |
| struct | ColorOptionTraits |
| Enables/disables/auto color for this module (from UNI20_COLOR or programmatic override). More... | |
| struct | ThreadIdOptionTraits |
| Controls thread-id prefixing (from UNI20_TRACE_THREAD_ID or module override). More... | |
Public Types | |
| using | ColorOptions = NamedEnumeration< ColorOptionTraits > |
| using | Sink = std::function< void(std::string)> |
| using | ThreadIdOptions = NamedEnumeration< ThreadIdOptionTraits > |
Public Member Functions | |
| void | append_glyph (uni20::presentation::styled_text &text, uni20::presentation::semantic_glyph glyph, std::string const &kind) const |
| Append a styled semantic glyph without rendering it immediately. | |
| void | append_style (uni20::presentation::styled_text &text, std::string_view str, std::string const &kind) const |
| Append styled text without rendering it immediately. | |
| std::string | format_glyph (uni20::presentation::semantic_glyph glyph, std::string const &kind) const |
| Format a semantic glyph using this module's style for the given kind. | |
| std::string | format_style (const std::string &str, const std::string &kind) const |
| Get or compute the terminal style for a given kind in this module. | |
| FormattingOptions () | |
| Default constructor. | |
| FormattingOptions (std::string_view module) | |
| Module‐specific constructor. | |
| uni20::presentation::mdspan_format_options & | mdspan_format_policy () |
| Return the shared mdspan/tensor presentation policy used by this trace module. | |
| uni20::presentation::mdspan_format_options const & | mdspan_format_policy () const |
| Return the shared mdspan/tensor presentation policy used by this trace module. | |
| uni20::presentation::mdspan_preview_options & | mdspan_preview_policy () |
| Return the shared mdspan/tensor preview policy used by this trace module. | |
| uni20::presentation::mdspan_preview_options const & | mdspan_preview_policy () const |
| Return the shared mdspan/tensor preview policy used by this trace module. | |
| uni20::presentation::numeric_format_options | numeric_format_policy () const |
| Build numeric formatting controls from trace precision settings. | |
| uni20::presentation::output_policy & | presentation_policy () |
| Return the shared presentation output policy used by this trace module. | |
| uni20::presentation::output_policy const & | presentation_policy () const |
| Return the shared presentation output policy used by this trace module. | |
| terminal::TerminalStyle | presentation_style (std::string_view kind) const |
| Return the terminal style associated with a trace style-map key. | |
| std::string | render (uni20::presentation::styled_text const &text) const |
| Render a presentation document through this trace module's policy. | |
| void | set_color_output (ColorOptions c) |
| Enable or disable color output for this module. | |
| void | set_color_output (uni20::presentation::color_mode c) |
| Enable, disable, or auto-detect color output using the shared presentation color mode. | |
| void | set_output_stream (FILE *f) |
| Change the output FILE* for this module. | |
| void | set_sink (Sink s) |
| Set a custom sink function for this module. | |
| bool | should_show_color () const |
| Query whether color should be used in this module. | |
Static Public Member Functions | |
| static bool | errors_abort () |
| Query the abort-on-error setting. | |
| static void | set_errors_abort (bool b) |
| Enable or disable abort-on-error for this module. | |
Public Attributes | |
| ColorOptions | color |
| int | fp_precision_float128 = 36 |
| Floating-point precision for formatting configured float128 values. | |
| int | fp_precision_float32 = 6 |
| Floating-point precision for formatting float32 values. | |
| int | fp_precision_float64 = 15 |
| Floating-point precision for formatting float64 values. | |
| uni20::presentation::mdspan_format_options | mdspanFormatPolicy |
| Presentation tensor-art policy used for mdspan and tensor-like values. | |
| uni20::presentation::mdspan_preview_options | mdspanPreviewPolicy |
| Presentation preview policy used for mdspan and tensor-like trace values. | |
| FILE * | outputStream = stderr |
| File to which this module writes (stderr by default, or UNI20_TRACEFILE). | |
| uni20::presentation::output_policy | renderPolicy = uni20::presentation::terminal_policy(outputStream) |
| Shared presentation rendering policy used by trace formatting. | |
| bool | showColor = terminal::is_a_terminal(stderr) |
| Whether to actually emit color sequences. | |
| Sink | sink |
| Function that actually emits strings (defaults to fputs to stderr). | |
| std::map< std::string, terminal::TerminalStyle > | Styles |
| Holds per-kind styles (keys like "TRACE", "TRACE_LINE", etc). | |
| int | terminal_width = terminal::columns(stderr) |
| Maximum width (in characters) before switching to multi-line. | |
| ThreadIdOptions | threadId = ThreadIdOptions() |
| bool | timestamp = false |
| Prefix each trace with a timestamp (from UNI20_TRACE_TIMESTAMP or module override). | |
Static Public Attributes | |
| static bool | errorsAbort = true |
| Abort on error if true. This is static, since it only makes sense globally. | |
Friends | |
| FormattingOptions & | get_formatting_options (const std::string &module) |
| get the FormattingOptions object for a given module; use "" as the module name (or default parameter) for the global format | |
Configuration and formatting options for a trace module.
| using trace::FormattingOptions::Sink = std::function<void(std::string)> |
|
inline |
Default constructor.
Seeds all built-in style keys and reads the global trace environment.
|
inline |
Module‐specific constructor.
Delegates to the default ctor then applies only trace module overrides:
|
inline |
Append a styled semantic glyph without rendering it immediately.
| text | Presentation document to append to. |
| glyph | Semantic presentation glyph. |
| kind | Style-map key to apply. |
|
inline |
Append styled text without rendering it immediately.
| text | Presentation document to append to. |
| str | Text payload. |
| kind | Style-map key to apply. |
|
inlinestatic |
Query the abort-on-error setting.
|
inline |
Format a semantic glyph using this module's style for the given kind.
| glyph | Semantic presentation glyph. |
| kind | Style-map key to apply. |
|
inline |
Get or compute the terminal style for a given kind in this module.
Format text using the "global" style (no module) for the given kind.
|
inline |
Return the shared mdspan/tensor presentation policy used by this trace module.
|
inline |
Return the shared mdspan/tensor presentation policy used by this trace module.
|
inline |
Return the shared mdspan/tensor preview policy used by this trace module.
|
inline |
Return the shared mdspan/tensor preview policy used by this trace module.
|
inline |
Build numeric formatting controls from trace precision settings.
|
inline |
Return the shared presentation output policy used by this trace module.
|
inline |
Return the shared presentation output policy used by this trace module.
|
inline |
Return the terminal style associated with a trace style-map key.
| kind | Style-map key such as TRACE or TRACE_LINE. |
|
inline |
Render a presentation document through this trace module's policy.
| text | Presentation document to render. |
|
inline |
Enable or disable color output for this module.
|
inline |
Enable, disable, or auto-detect color output using the shared presentation color mode.
|
inlinestatic |
Enable or disable abort-on-error for this module.
|
inline |
Change the output FILE* for this module.
|
inline |
Set a custom sink function for this module.
|
inline |
Query whether color should be used in this module.
|
friend |
get the FormattingOptions object for a given module; use "" as the module name (or default parameter) for the global format
Returns the FormattingOptions for a module, or the “default” when called with no args.
Empty module name ⇒ use the no-arg ctor (global defaults only).
| ColorOptions trace::FormattingOptions::color |
|
inlinestatic |
Abort on error if true. This is static, since it only makes sense globally.
| int trace::FormattingOptions::fp_precision_float128 = 36 |
Floating-point precision for formatting configured float128 values.
| int trace::FormattingOptions::fp_precision_float32 = 6 |
Floating-point precision for formatting float32 values.
| int trace::FormattingOptions::fp_precision_float64 = 15 |
Floating-point precision for formatting float64 values.
| uni20::presentation::mdspan_format_options trace::FormattingOptions::mdspanFormatPolicy |
Presentation tensor-art policy used for mdspan and tensor-like values.
| uni20::presentation::mdspan_preview_options trace::FormattingOptions::mdspanPreviewPolicy |
Presentation preview policy used for mdspan and tensor-like trace values.
| FILE* trace::FormattingOptions::outputStream = stderr |
File to which this module writes (stderr by default, or UNI20_TRACEFILE).
| uni20::presentation::output_policy trace::FormattingOptions::renderPolicy = uni20::presentation::terminal_policy(outputStream) |
Shared presentation rendering policy used by trace formatting.
| bool trace::FormattingOptions::showColor = terminal::is_a_terminal(stderr) |
Whether to actually emit color sequences.
| Sink trace::FormattingOptions::sink |
Function that actually emits strings (defaults to fputs to stderr).
|
mutable |
Holds per-kind styles (keys like "TRACE", "TRACE_LINE", etc).
| int trace::FormattingOptions::terminal_width = terminal::columns(stderr) |
Maximum width (in characters) before switching to multi-line.
| ThreadIdOptions trace::FormattingOptions::threadId = ThreadIdOptions() |
| bool trace::FormattingOptions::timestamp = false |
Prefix each trace with a timestamp (from UNI20_TRACE_TIMESTAMP or module override).