|
Mallard 0.8.0
Unstructured, GPU accelerated, high-order finite volume CFD solver
Mallard website |
Console output: rank-0 info lines, aligned sections and tables, warnings and errors on stderr, optional color on terminals. More...
#include <cstdint>#include <string>#include <string_view>#include <utility>#include <vector>Go to the source code of this file.
Namespaces | |
| namespace | logging |
Macros | |
| #define | MALLARD_PRINTF(fmt, args) |
Typedefs | |
| using | logging::Items = std::vector< std::pair< std::string, std::string > > |
| Key-value lines of a setup section, in display order. | |
Enumerations | |
| enum class | logging::Style { logging::BOLD , logging::DIM , logging::RED , logging::YELLOW , logging::GREEN , logging::CYAN } |
Functions | |
| std::string | logging::format (const char *fmt,...) MALLARD_PRINTF(1 |
| printf-style formatting into a std::string. | |
| std::string | logging::style (std::string_view text, Style s) |
| Wraps text in an ANSI style when stdout gets color, else returns it unchanged. | |
| bool | logging::color_stdout () |
| Whether to color stdout (stderr): a terminal, NO_COLOR unset and not under an MPI launcher, or CLICOLOR_FORCE set. | |
| bool | logging::color_stderr () |
| void | logging::line (std::string_view text="") |
| Prints a line on stdout from rank 0. | |
| void | logging::section (std::string_view title, std::string_view right="") |
| Section heading, e.g. "== Mesh ===...=== 0.12 s". | |
| void | logging::item (std::string_view key, std::string_view value) |
| Aligned " key value" line under a section. | |
| void | logging::items (const Items &list) |
| void | logging::begin_phase (std::string_view name) |
| Starts a line naming a setup phase; end_phase() completes it with the elapsed time. Anything printed in between first ends the open line. | |
| void | logging::end_phase (double seconds) |
| void | logging::event (uint64_t step, double t, std::string_view kind, std::string_view text) |
| One-line event during the run (e.g. a file written), led by the step and time so it lines up with the progress table. | |
| void | logging::warning (std::string_view message) |
| Warning on stderr from rank 0, for conditions every rank sees alike. | |
| void | logging::error (std::string_view message) |
| Error on stderr from the calling rank, prefixed with the rank in parallel runs. | |
| std::string | logging::count (uint64_t n) |
| 1234567 -> "1,234,567". | |
| std::string | logging::duration (double seconds) |
| Wall-clock duration: "850 us", "12.3 ms", "4.56 s", "12m 03s", "2h 05m". | |
| std::string | logging::si (double value) |
| Value with an SI suffix and 3 significant digits: "16.3M", "1.20k". | |
| std::string | logging::real (double value) |
| Compact real: "%.6g". | |
Variables | |
| constexpr int | logging::WIDTH = 92 |
| Width of section rules and the target maximum line width. | |
| constexpr int | logging::KEY_WIDTH = 18 |
| Column at which the values of key-value lines start. | |
Console output: rank-0 info lines, aligned sections and tables, warnings and errors on stderr, optional color on terminals.