Stream buffer for the message logger. More...


Classes | |
struct | Settings |
Public Member Functions | |
LoggerBuffer (const LoggerBuffer &other)=delete | |
LoggerBuffer (int nProcesses, int rank, std::size_t bufferSize=256) | |
LoggerBuffer (LoggerBuffer &&other)=delete | |
~LoggerBuffer () | |
int | flush (bool terminate) |
std::ostream & | getConsoleStream () |
std::ofstream & | getFileStream () |
int | getProcessCount () const |
int | getRank () const |
const Settings * | getSettings () const |
void | setConsoleEnabled (bool enabled) |
void | setConsoleStream (std::ostream *console) |
void | setFileEnabled (bool enabled) |
void | setFileStream (std::ofstream *file) |
void | setSettings (const std::shared_ptr< Settings > &settings) |
Detailed Description
Stream buffer for the message logger.
This class implements a stream buffer used by the message logger.
Definition at line 83 of file logger.hpp.
Constructor & Destructor Documentation
◆ LoggerBuffer()
bitpit::LoggerBuffer::LoggerBuffer | ( | int | nProcesses, |
int | rank, | ||
std::size_t | bufferSize = 256 ) |
Creates a new buffer.
- Parameters
-
nProcesses is the total number of processes in the communicator rank is the parallel rank in the communicator bufferSize is the size of the internal buffer
Definition at line 63 of file logger.cpp.
◆ ~LoggerBuffer()
bitpit::LoggerBuffer::~LoggerBuffer | ( | ) |
Destructor
Definition at line 100 of file logger.cpp.
Member Function Documentation
◆ flush()
int bitpit::LoggerBuffer::flush | ( | bool | terminate | ) |
Flushes stream buffer.
- Parameters
-
terminate if true ensures that a new line is added as last character
- Returns
- Returns 0 to indicates success, -1 to indicate failure.
Definition at line 173 of file logger.cpp.
◆ getConsoleStream()
std::ostream & bitpit::LoggerBuffer::getConsoleStream | ( | ) |
Gets the stream to be used for the output on the console.
- Returns
- The stream to be used for the output on the console.
Definition at line 342 of file logger.cpp.
◆ getFileStream()
std::ofstream & bitpit::LoggerBuffer::getFileStream | ( | ) |
Gets the stream to be used for the output on the file.
- Returns
- The stream to be used for the output on the file.
Definition at line 384 of file logger.cpp.
◆ getProcessCount()
int bitpit::LoggerBuffer::getProcessCount | ( | ) | const |
Count the number of processes in the communicator.
- Returns
- The number of processes in the communicator.
Definition at line 110 of file logger.cpp.
◆ getRank()
int bitpit::LoggerBuffer::getRank | ( | ) | const |
Gets the rank in the communicator.
- Returns
- The rank in the communicator.
Definition at line 120 of file logger.cpp.
◆ getSettings()
const LoggerBuffer::Settings * bitpit::LoggerBuffer::getSettings | ( | ) | const |
Get a constant pointer to the buffer settings.
- Returns
- A constant pointer to the buffer settings.
Definition at line 394 of file logger.cpp.
◆ setConsoleEnabled()
void bitpit::LoggerBuffer::setConsoleEnabled | ( | bool | enabled | ) |
Enables the output on the console.
- Parameters
-
enabled if set to true enables the console output.
Definition at line 314 of file logger.cpp.
◆ setConsoleStream()
void bitpit::LoggerBuffer::setConsoleStream | ( | std::ostream * | console | ) |
Sets the stream to be used for the output on the console.
- Parameters
-
console is the stream to be used for the output on the console
Definition at line 330 of file logger.cpp.
◆ setFileEnabled()
void bitpit::LoggerBuffer::setFileEnabled | ( | bool | enabled | ) |
Enables the output on the log file.
The output on the log file can be enabled only id the log file path has been set. If there is no log file path specified, the output on the file will not be enabled.
- Parameters
-
enabled if set to true enables the output on the log file
Definition at line 356 of file logger.cpp.
◆ setFileStream()
void bitpit::LoggerBuffer::setFileStream | ( | std::ofstream * | file | ) |
Sets the stream to be used for the output on the file.
- Parameters
-
file is the stream to be used for the output on the file
Definition at line 372 of file logger.cpp.
◆ setSettings()
void bitpit::LoggerBuffer::setSettings | ( | const std::shared_ptr< Settings > & | settings | ) |
Sets buffer settings.
- Parameters
-
settings are the buffer settings
Definition at line 404 of file logger.cpp.
The documentation for this class was generated from the following files:
- src/common/logger.hpp
- src/common/logger.cpp
