1 #ifndef ABLATELIBRARY_LOG_HPP
2 #define ABLATELIBRARY_LOG_HPP
9 namespace ablate::monitors::logs {
12 bool initialized =
false;
17 class DefaultOutBuffer :
public std::streambuf {
22 int_type overflow(int_type c)
override {
24 log.Printf(
"%c",
static_cast<char>(c));
30 DefaultOutBuffer(
Log& log) : log(log) {}
34 std::unique_ptr<std::ostream> ostream;
37 std::unique_ptr<DefaultOutBuffer> ostreambuf;
43 virtual void Printf(
const char*, ...) = 0;
44 virtual void Print(
const char* value) { Printf(value); }
45 virtual void Print(
const char* name, std::size_t num,
const double*,
const char* format =
nullptr);
46 virtual void Initialize(MPI_Comm comm = MPI_COMM_SELF) { initialized =
true; }
49 void Print(
const char* name,
const std::vector<double>& values,
const char* format =
nullptr);
52 inline const bool& Initialized()
const {
return initialized; }
virtual std::ostream & GetStream()
Definition: log.cpp:35