|
| | ~ITACLogger () |
| |
| bool | getLogMachineName () const |
| | Is public as some analysis frameworks check explicitly whether these features are switched on.
|
| |
| bool | getLogThreadName () const |
| | Is public as some analysis frameworks check explicitly whether these features are switched on.
|
| |
| bool | getLogTrace () const |
| | Is public as some analysis frameworks check explicitly whether these features are switched on.
|
| |
| bool | getLogTimeStamp () const |
| | Is public as some analysis frameworks check explicitly whether these features are switched on.
|
| |
| void | debug (long int timestampNanoseconds, int rank, int threadId, const std::string &trace, const std::string &message) |
| |
| void | info (long int timestampNanoseconds, int rank, int threadId, const std::string &trace, const std::string &message) |
| |
| void | warning (long int timestampNanoseconds, int rank, int threadId, const std::string &trace, const std::string &message) |
| | Write Warning.
|
| |
| void | error (long int timestampNanoseconds, int rank, int threadId, const std::string &trace, const std::string &message) |
| | Write Error.
|
| |
| void | traceIn (long int timestampNanoseconds, int rank, int threadId, const std::string &trace, const std::string &message) |
| |
| void | traceOut (long int timestampNanoseconds, int rank, int threadId, const std::string &trace, const std::string &message) |
| |
| void | indent (bool indent, const std::string &trace) |
| | Tells the logger to increment/decrement the indent.
|
| |
| void | close () |
| |
| void | suspendTrace () |
| |
| void | continueTrace () |
| |
Command Line Logger.
Standard log output device. Implements the LogHandle. Usually there's only one instance of this class, as the Log type (which is implicitly used by all log and trace macros) forwards all data to a singleton.
Error and warnings
All error and warning messages are dumped to \texttt{cerr}. The logger automatically aborts the application if it encounters an error, once the error message is written and \texttt{cerr} is flushed.
Info and debugging
Debug information is piped to \texttt{cout}. The same happens with writes to the \texttt{info} log level.
Thread safety
All logs are protected by a semaphore to avoid race conditions.
- Author
- Tobias Weinzierl, Wolfgang Eckhardt
Definition at line 51 of file ITACLogger.h.
| std::string tarch::logging::ITACLogger::constructMessageString |
( |
std::string | messageType, |
|
|
long int | timestampNanoseconds, |
|
|
int | rank, |
|
|
int | threadId, |
|
|
const std::string & | trace, |
|
|
const std::string & | message ) |
|
private |
Construct message string.
!!! Thread Safety
The message string relies on the global field _indent. This one might change throughout the execution of this method. However, I accept such a behavior: Changing _indent throughout the message execution makes the method add the wrong number of whitespaces in front of the message. That is a 'bug' we can accept.
To satisfy Intel Inspector et al at least slightly, I copy over _indent before I actually construct the message string. So the indent can't change while we add the spaces/tabs to the output.
| void tarch::logging::ITACLogger::error |
( |
long int | timestampNanoseconds, |
|
|
int | rank, |
|
|
int | threadId, |
|
|
const std::string & | trace, |
|
|
const std::string & | message ) |
Write Error.
In the implementation, I call a flush on cout before I write to cerr. Otherwise, the cerr messages might overtake cout. Before the operation returns, it does a flush on cerr, too. Otherwise, the message might not occur, i.e. the application might shut down before the message is flushed to the terminal.
| void tarch::logging::ITACLogger::indent |
( |
bool | indent, |
|
|
const std::string & | trace ) |
Tells the logger to increment/decrement the indent.
For ITAC, we do not need any indentation. Consequently, we put the nop implementation into the header, so the compiler can inline the call and eventually remove it completely.
Definition at line 170 of file ITACLogger.h.
| void tarch::logging::ITACLogger::warning |
( |
long int | timestampNanoseconds, |
|
|
int | rank, |
|
|
int | threadId, |
|
|
const std::string & | trace, |
|
|
const std::string & | message ) |
Write Warning.
In the implementation, I call a flush on cout before I write to cerr. Otherwise, the cerr messages might overtake cout. Before the operation returns, it does a flush on cerr, too. Otherwise, the message might not occur, i.e. the application might shut down before the message is flushed to the terminal.