Concrete instance of LogStream, which implements functionality for logging messages to a C++ ostream object, e.g., std::cout, std::cerr, a std::ofstream, std::ostringstream, etc.
More...
#include </home/docs/checkouts/readthedocs.org/user_builds/axom/checkouts/v0.6.0/src/axom/slic/streams/GenericOutputStream.hpp>
|
std::string | getFormatedMessage (const std::string &msgLevel, const std::string &message, const std::string &tagName, const std::string &rank, const std::string &fileName, int line) |
| Returns the formatted message as a single string. More...
|
|
std::string | getTimeStamp () |
| Returns a time-stamp. More...
|
|
Concrete instance of LogStream, which implements functionality for logging messages to a C++ ostream object, e.g., std::cout, std::cerr, a std::ofstream, std::ostringstream, etc.
- See also
- LogStream Logger
◆ GenericOutputStream() [1/2]
axom::slic::GenericOutputStream::GenericOutputStream |
( |
std::ostream * |
os | ) |
|
Constructs a GenericOutpuStream instance with the given stream.
- Parameters
-
[in] | os | pointer to a user-supplied ostream instance. |
- Precondition
- os != NULL
◆ GenericOutputStream() [2/2]
axom::slic::GenericOutputStream::GenericOutputStream |
( |
std::ostream * |
os, |
|
|
const std::string & |
format |
|
) |
| |
Constructs a GenericOutputStream instance with the given stream and message formatting.
- Parameters
-
[in] | os | pointer to a user-supplied ostream instance. |
[in] | format | the format string. |
- See also
- LogStream::setFormatString for the format string.
◆ ~GenericOutputStream()
virtual axom::slic::GenericOutputStream::~GenericOutputStream |
( |
| ) |
|
|
virtual |
◆ append()
virtual void axom::slic::GenericOutputStream::append |
( |
message::Level |
msgLevel, |
|
|
const std::string & |
message, |
|
|
const std::string & |
tagName, |
|
|
const std::string & |
fileName, |
|
|
int |
line, |
|
|
bool |
filter_duplicates |
|
) |
| |
|
virtual |
◆ setFormatString()
void axom::slic::LogStream::setFormatString |
( |
const std::string & |
format | ) |
|
|
inlineinherited |
Sets the format string.
- Parameters
-
- Note
- The following keywords in the format string are replaced:
-
<LEVEL> with the message type, e.g, ERROR, FATAL, etc.
-
<MESSAGE> with the user-supplied message
-
<TAG> user-supplied tag
-
<FILE> with the filename
-
<LINE> with the line number
-
<LINE> with the MPI rank
-
<TIMESTAMP> date/time the message is logged
An example illustrating how an application can setup the format string is shown below:
std::string format =
std::string( "***********************************\n" )+
std::string( "* <TIMESTAMP>\n\n" ) +
std::string( "* LEVEL=<LEVEL>\n" ) +
std::string( "* MESSAGE=<MESSAGE>\n" ) +
std::string( "* FILE=<FILE>\n" ) +
std::string( "* LINE=<LINE>\n" ) +
std::string( "* RANK=<RANK>\n" ) +
std::string( "***********************************\n" );
References axom::slic::LogStream::append().
◆ flush()
virtual void axom::slic::LogStream::flush |
( |
| ) |
|
|
inlinevirtualinherited |
Flushes the log stream. It's a NO-OP by default.
- Note
- The intent of this method is to be overridden by concrete implementations. This is primarily useful for applications running in a distributed MPI environment, where the flush is a collective operation intended for a synchronization checkpoint.
Reimplemented in axom::slic::LumberjackStream, and axom::slic::SynchronizedStream.
◆ push()
virtual void axom::slic::LogStream::push |
( |
| ) |
|
|
inlinevirtualinherited |
◆ getFormatedMessage()
std::string axom::slic::LogStream::getFormatedMessage |
( |
const std::string & |
msgLevel, |
|
|
const std::string & |
message, |
|
|
const std::string & |
tagName, |
|
|
const std::string & |
rank, |
|
|
const std::string & |
fileName, |
|
|
int |
line |
|
) |
| |
|
protectedinherited |
Returns the formatted message as a single string.
- Parameters
-
[in] | msgLevel | the level of the given message. |
[in] | message | the user-supplied message. |
[in] | tagName | user-supplied tag, may be MSG_IGNORE_TAG |
[in] | fileName | filename where this message is logged, may be MSG_IGNORE_FILE to ignore this field. |
[in] | line | the line number within the file where the message is logged. Likewise, may be set to MSG_IGNORE_LINE to ignore this field. |
- Returns
- str the formatted message string.
- Postcondition
- str != "".
Referenced by axom::slic::LogStream::push().
◆ getTimeStamp()
std::string axom::slic::LogStream::getTimeStamp |
( |
| ) |
|
|
protectedinherited |
The documentation for this class was generated from the following file:
- /home/docs/checkouts/readthedocs.org/user_builds/axom/checkouts/v0.6.0/src/axom/slic/streams/GenericOutputStream.hpp