Quandary
Loading...
Searching...
No Matches
Public Member Functions | List of all members
MPILogger Class Reference

MPI-aware logger that handles rank filtering and quiet mode. More...

#include <mpi_logger.hpp>

Public Member Functions

 MPILogger (int rank, bool quiet=false)
 Constructs an MPI logger.
 
void log (const std::string &message) const
 Logs a message to stdout (rank 0 only, respects quiet mode).
 
void error (const std::string &message) const
 Logs an error message to stderr (rank 0 only).
 
void exitWithError (const std::string &message) const
 Logs an error and terminates the program.
 

Detailed Description

MPI-aware logger that handles rank filtering and quiet mode.

Encapsulates MPI rank and quiet mode to simplify logging calls throughout the codebase. Only rank 0 outputs messages, and quiet mode can suppress output.

Constructor & Destructor Documentation

◆ MPILogger()

MPILogger::MPILogger ( int  rank,
bool  quiet = false 
)
inline

Constructs an MPI logger.

Parameters
rankMPI rank of the current process
quietIf true, suppresses non-error output

Member Function Documentation

◆ error()

void MPILogger::error ( const std::string &  message) const
inline

Logs an error message to stderr (rank 0 only).

Parameters
messageError message to log

◆ exitWithError()

void MPILogger::exitWithError ( const std::string &  message) const
inline

Logs an error and terminates the program.

Parameters
messageError message before exit

◆ log()

void MPILogger::log ( const std::string &  message) const
inline

Logs a message to stdout (rank 0 only, respects quiet mode).

Parameters
messageMessage to log

The documentation for this class was generated from the following file: