|
OOFEM 3.0
|
#include <logger.h>
Public Types | |
| enum | logLevelType { LOG_LEVEL_FORCED =-1 , LOG_LEVEL_FATAL =0 , LOG_LEVEL_ERROR =0 , LOG_LEVEL_WARNING = 1 , LOG_LEVEL_RELEVANT = 2 , LOG_LEVEL_INFO = 3 , LOG_LEVEL_ALL = 4 , LOG_LEVEL_DEBUG = 4 } |
| Type defining basic log levels. More... | |
Public Member Functions | |
| Logger (logLevelType level) | |
| ~Logger () | |
| void | appendLogTo (const std ::string &fname) |
| Redirects log output to given file name (with path). | |
| void | appendErrorTo (const std ::string &fname) |
| Redirects error output to given file name (with path). | |
| void | appendLogTo (FILE *stream) |
| Redirects log output to given stream. | |
| void | appendErrorTo (FILE *stream) |
| Redirects error output to given stream. | |
| void | setComm (MPI_Comm comm) |
| Parallell comm. | |
| void | writeLogMsg (logLevelType level, const char *format,...) |
| Writes the normal log message. | |
| void | writeELogMsg (logLevelType level, const char *_func, const char *_file, int _line, const char *format,...) |
| Writes extended log message with file and line info. | |
| void | flush () |
| Flushes the log stream. | |
| void | setLogLevel (logLevelType level) |
| Sets log level to given one. Only log messages with level less or equal given threshold will be printed. | |
| void | setLogLevel (int level) |
| Sets log level to given one. Only log messages with level less or equal given threshold will be printed. | |
| void | incrementErrorCounter () |
| Increment error count by one. | |
| void | printStatistics () |
| Prints number of errors and warning logged. | |
| void | getNumberOfWarningsAndErrors (int &nwrns, int &nerrs) |
| Returns local (mpi-process) statistics. | |
Protected Member Functions | |
| const char * | giveLevelName (logLevelType l) const |
Protected Attributes | |
| FILE * | logStream |
| Stream used for logging. | |
| FILE * | errStream |
| bool | closeFlag |
| flag indicating whether to close mylogStream. | |
| bool | errCloseFlag |
| logLevelType | logLevel |
| Current log level, messages with higher level are not reported. | |
| int | numberOfWrn |
| Counter of all warning and error messages. | |
| int | numberOfErr |
| MPI_Comm | comm |
| Parallell comm. | |
Logger class used by OOFEM to print information during analysis. Prints warnings and errors into a separate stream from normal output.
| oofem::Logger::Logger | ( | logLevelType | level | ) |
Definition at line 52 of file logger.C.
References closeFlag, comm, errCloseFlag, errStream, logLevel, logStream, numberOfErr, and numberOfWrn.
| oofem::Logger::~Logger | ( | ) |
| void oofem::Logger::appendErrorTo | ( | const std ::string & | fname | ) |
Redirects error output to given file name (with path).
Definition at line 95 of file logger.C.
References errCloseFlag, errStream, and OOFEM_WARNING.
| void oofem::Logger::appendErrorTo | ( | FILE * | stream | ) |
Redirects error output to given stream.
Definition at line 130 of file logger.C.
References errCloseFlag, errStream, and OOFEM_ERROR.
| void oofem::Logger::appendLogTo | ( | const std ::string & | fname | ) |
Redirects log output to given file name (with path).
Definition at line 76 of file logger.C.
References closeFlag, logStream, and OOFEM_WARNING.
| void oofem::Logger::appendLogTo | ( | FILE * | stream | ) |
Redirects log output to given stream.
Definition at line 114 of file logger.C.
References closeFlag, logStream, and OOFEM_ERROR.
|
inline |
|
inline |
Returns local (mpi-process) statistics.
Definition at line 122 of file logger.h.
References numberOfErr, and numberOfWrn.
|
protected |
Definition at line 223 of file logger.C.
References LOG_LEVEL_ERROR, and LOG_LEVEL_WARNING.
Referenced by writeELogMsg().
|
inline |
| void oofem::Logger::printStatistics | ( | ) |
Prints number of errors and warning logged.
Definition at line 255 of file logger.C.
References comm, logStream, numberOfErr, and numberOfWrn.
| void oofem::Logger::setComm | ( | MPI_Comm | comm | ) |
| void oofem::Logger::setLogLevel | ( | int | level | ) |
Sets log level to given one. Only log messages with level less or equal given threshold will be printed.
Definition at line 239 of file logger.C.
References LOG_LEVEL_DEBUG, LOG_LEVEL_FATAL, and logLevel.
|
inline |
| void oofem::Logger::writeELogMsg | ( | logLevelType | level, |
| const char * | _func, | ||
| const char * | _file, | ||
| int | _line, | ||
| const char * | format, | ||
| ... ) |
Writes extended log message with file and line info.
Definition at line 179 of file logger.C.
References errStream, giveLevelName(), LOG_ERR_HEADER, LOG_ERR_TAIL, LOG_LEVEL_ERROR, LOG_LEVEL_FATAL, LOG_LEVEL_WARNING, logLevel, logStream, numberOfErr, numberOfWrn, and oofem::print_stacktrace().
| void oofem::Logger::writeLogMsg | ( | logLevelType | level, |
| const char * | format, | ||
| ... ) |
Writes the normal log message.
Definition at line 148 of file logger.C.
References comm, errStream, LOG_LEVEL_ERROR, LOG_LEVEL_FATAL, LOG_LEVEL_WARNING, logLevel, logStream, numberOfErr, and numberOfWrn.
|
protected |
flag indicating whether to close mylogStream.
Definition at line 73 of file logger.h.
Referenced by appendLogTo(), appendLogTo(), Logger(), and ~Logger().
|
protected |
Parallell comm.
Definition at line 80 of file logger.h.
Referenced by Logger(), printStatistics(), setComm(), and writeLogMsg().
|
protected |
Definition at line 73 of file logger.h.
Referenced by appendErrorTo(), appendErrorTo(), Logger(), and ~Logger().
|
protected |
Definition at line 71 of file logger.h.
Referenced by appendErrorTo(), appendErrorTo(), flush(), Logger(), writeELogMsg(), writeLogMsg(), and ~Logger().
|
protected |
Current log level, messages with higher level are not reported.
Definition at line 75 of file logger.h.
Referenced by Logger(), setLogLevel(), setLogLevel(), writeELogMsg(), and writeLogMsg().
|
protected |
Stream used for logging.
Definition at line 71 of file logger.h.
Referenced by appendLogTo(), appendLogTo(), flush(), Logger(), printStatistics(), writeELogMsg(), writeLogMsg(), and ~Logger().
|
protected |
Definition at line 77 of file logger.h.
Referenced by getNumberOfWarningsAndErrors(), incrementErrorCounter(), Logger(), printStatistics(), writeELogMsg(), and writeLogMsg().
|
protected |
Counter of all warning and error messages.
Definition at line 77 of file logger.h.
Referenced by getNumberOfWarningsAndErrors(), Logger(), printStatistics(), writeELogMsg(), and writeLogMsg().