hemocell
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
hemo::Logfile Class Reference

#include <logfile.h>

Public Member Functions

 Logfile ()
 
 Logfile (std::fstream &logfile_)
 
bool open (const std::string &filename_)
 
void close ()
 Close the log file and stop logging (called when HemoCell is destroyed).
 

Public Attributes

std::fstream & logfile
 
std::string filename = ""
 
bool mainProcess = false
 True on the process that writes the log (MPI rank 0); set by HemoCell.
 
std::ostringstream pending
 Messages logged on the main process before the log file was opened.
 

Detailed Description

Log stream of HemoCell (hlog): writes to stdout and to the log file, on the main MPI process only.

The log file is opened by loadDirectories(), which for checkpointed runs happens only in loadCheckPoint(). Messages logged before that (setup parameters, warnings, errors before an exit) are printed immediately and kept in pending, which open() writes to the top of the file.

Constructor & Destructor Documentation

◆ Logfile() [1/2]

hemo::Logfile::Logfile ( )
inline

◆ Logfile() [2/2]

hemo::Logfile::Logfile ( std::fstream &  logfile_)
inline

Member Function Documentation

◆ close()

void hemo::Logfile::close ( )
inline

Close the log file and stop logging (called when HemoCell is destroyed).

◆ open()

bool hemo::Logfile::open ( const std::string &  filename_)
inline

Open the log file (if not open yet) and write the pending messages.

Returns
whether the log file is open afterwards.

Member Data Documentation

◆ filename

std::string hemo::Logfile::filename = ""

◆ logfile

std::fstream& hemo::Logfile::logfile

◆ mainProcess

bool hemo::Logfile::mainProcess = false

True on the process that writes the log (MPI rank 0); set by HemoCell.

◆ pending

std::ostringstream hemo::Logfile::pending

Messages logged on the main process before the log file was opened.