COOLFluiD
Release kernel
COOLFluiD is a Collaborative Simulation Environment (CSE) focused on complex MultiPhysics simulations.
|
Prepends a stamp to the log messages. More...
#include <LogStampFilter.hpp>
Public Types | |
typedef char | char_type |
typedef boost::iostreams::multichar_output_filter_tag | category |
Public Member Functions | |
LogStampFilter (const std::string &streamName, const std::string &stamp=std::string()) | |
Constructor. More... | |
void | setStamp (const std::string &stamp) |
Sets stamp. More... | |
std::string | getStamp () const |
Gives the stamps. More... | |
void | setPlace (const CodeLocation &place) |
Sets the code location. More... | |
void | endMessage () |
Ends message. More... | |
template<typename Sink > | |
std::streamsize | write (Sink &sink, const char_type *data, std::streamsize size) |
Writes data to a sink. More... | |
Private Attributes | |
CodeLocation | m_place |
The current code location. More... | |
std::string | m_stamp |
The current stamp. More... | |
std::string | m_streamName |
The stream name. More... | |
bool | m_newMessage |
Indicates whether it is a new message or not. More... | |
Prepends a stamp to the log messages.
This class is written to act as a Boost.Iostreams filter. It defines char_type
and category
types and a write
method for that purpose.
The stamp can be personalized with setStamp()
. Four tags are regonized:
%time%
: Timestamp (seconds elapsed since the application has been launched). %place%
: The code location, as given by #CodeLocation::strShort()
%type%
: The stream name %rank%
: The MPI process rankDefinition at line 42 of file LogStampFilter.hpp.
typedef boost::iostreams::multichar_output_filter_tag category |
Definition at line 47 of file LogStampFilter.hpp.
typedef char char_type |
Definition at line 46 of file LogStampFilter.hpp.
LogStampFilter | ( | const std::string & | streamName, |
const std::string & | stamp = std::string() |
||
) |
Constructor.
streamName | The stream name. |
stamp | The stamp. Can be empty. |
Definition at line 11 of file LogStampFilter.cpp.
void endMessage | ( | ) |
Ends message.
After calling this method, the stamp will be prepended again on the next call to write
.
Definition at line 40 of file LogStampFilter.cpp.
std::string getStamp | ( | ) | const |
void setPlace | ( | const CodeLocation & | place | ) |
Sets the code location.
place | The code location |
Definition at line 48 of file LogStampFilter.cpp.
void setStamp | ( | const std::string & | stamp | ) |
Sets stamp.
stamp | The stamp. Can be empty. |
Definition at line 24 of file LogStampFilter.cpp.
|
inline |
Writes data to a sink.
If it is a new message, the stamp is prepended.
size
or (size
+ the size of the stamp) if the stamp has been prepended. Definition at line 84 of file LogStampFilter.hpp.
|
private |
Indicates whether it is a new message or not.
If true
, the stamp will be prepended on the next call of write
. It can be set back to true
by calling endMessage()
Definition at line 125 of file LogStampFilter.hpp.
|
private |
The current code location.
Definition at line 113 of file LogStampFilter.hpp.
|
private |
The current stamp.
Definition at line 116 of file LogStampFilter.hpp.
|
private |
The stream name.
Definition at line 119 of file LogStampFilter.hpp.
Send comments to: COOLFluiD Web Admin |