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

Console output implementation. More...

#include "log.h"
#include <cmath>
#include <cstdarg>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <unistd.h>
#include "comm.h"

Namespaces

namespace  logging
 

Functions

std::string logging::format (const char *fmt,...) MALLARD_PRINTF(1
 printf-style formatting into a std::string.
 
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 ()
 
std::string logging::style (std::string_view text, Style s)
 Wraps text in an ANSI style when stdout gets color, else returns it unchanged.
 
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".
 

Detailed Description

Console output implementation.