Mallard 0.8.0
Unstructured, GPU accelerated, high-order finite volume CFD solver
Mallard website
Loading...
Searching...
No Matches
logging Namespace Reference

Typedefs

using Items = std::vector< std::pair< std::string, std::string > >
 Key-value lines of a setup section, in display order.
 

Enumerations

enum class  Style {
  BOLD , DIM , RED , YELLOW ,
  GREEN , CYAN
}
 

Functions

std::string format (const char *fmt,...) MALLARD_PRINTF(1
 printf-style formatting into a std::string.
 
bool color_stdout ()
 Whether to color stdout (stderr): a terminal, NO_COLOR unset and not under an MPI launcher, or CLICOLOR_FORCE set.
 
bool color_stderr ()
 
std::string style (std::string_view text, Style s)
 Wraps text in an ANSI style when stdout gets color, else returns it unchanged.
 
void line (std::string_view text="")
 Prints a line on stdout from rank 0.
 
void section (std::string_view title, std::string_view right="")
 Section heading, e.g. "== Mesh ===...=== 0.12 s".
 
void item (std::string_view key, std::string_view value)
 Aligned " key value" line under a section.
 
void items (const Items &list)
 
void 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 end_phase (double seconds)
 
void 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 warning (std::string_view message)
 Warning on stderr from rank 0, for conditions every rank sees alike.
 
void error (std::string_view message)
 Error on stderr from the calling rank, prefixed with the rank in parallel runs.
 
std::string count (uint64_t n)
 1234567 -> "1,234,567".
 
std::string duration (double seconds)
 Wall-clock duration: "850 us", "12.3 ms", "4.56 s", "12m 03s", "2h 05m".
 
std::string si (double value)
 Value with an SI suffix and 3 significant digits: "16.3M", "1.20k".
 
std::string real (double value)
 Compact real: "%.6g".
 

Variables

constexpr int WIDTH = 92
 Width of section rules and the target maximum line width.
 
constexpr int KEY_WIDTH = 18
 Column at which the values of key-value lines start.
 

Typedef Documentation

◆ Items

using logging::Items = typedef std::vector<std::pair<std::string, std::string> >

Key-value lines of a setup section, in display order.

Enumeration Type Documentation

◆ Style

Enumerator
BOLD 
DIM 
RED 
YELLOW 
GREEN 
CYAN 

Function Documentation

◆ begin_phase()

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.

◆ color_stderr()

bool logging::color_stderr ( )

◆ color_stdout()

bool logging::color_stdout ( )

Whether to color stdout (stderr): a terminal, NO_COLOR unset and not under an MPI launcher, or CLICOLOR_FORCE set.

◆ count()

std::string logging::count ( uint64_t  n)

1234567 -> "1,234,567".

◆ duration()

std::string logging::duration ( double  s)

Wall-clock duration: "850 us", "12.3 ms", "4.56 s", "12m 03s", "2h 05m".

◆ end_phase()

void logging::end_phase ( double  seconds)

◆ error()

void logging::error ( std::string_view  message)

Error on stderr from the calling rank, prefixed with the rank in parallel runs.

◆ event()

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.

◆ format()

std::string logging::format ( const char *  fmt,
  ... 
)

printf-style formatting into a std::string.

◆ item()

void logging::item ( std::string_view  key,
std::string_view  value 
)

Aligned " key value" line under a section.

◆ items()

void logging::items ( const Items &  list)

◆ line()

void logging::line ( std::string_view  text)

Prints a line on stdout from rank 0.

◆ real()

std::string logging::real ( double  v)

Compact real: "%.6g".

◆ section()

void logging::section ( std::string_view  title,
std::string_view  right 
)

Section heading, e.g. "== Mesh ===...=== 0.12 s".

◆ si()

std::string logging::si ( double  v)

Value with an SI suffix and 3 significant digits: "16.3M", "1.20k".

◆ style()

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.

◆ warning()

void logging::warning ( std::string_view  message)

Warning on stderr from rank 0, for conditions every rank sees alike.

Variable Documentation

◆ KEY_WIDTH

constexpr int logging::KEY_WIDTH = 18
constexpr

Column at which the values of key-value lines start.

◆ WIDTH

constexpr int logging::WIDTH = 92
constexpr

Width of section rules and the target maximum line width.