OOFEM
2.4
OOFEM.org - Object Oriented Finite Element Solver
|
Logger class used by OOFEM to print information during analysis. More...
#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). More... | |
void | appendErrorTo (const std::string &fname) |
Redirects error output to given file name (with path). More... | |
void | appendLogTo (FILE *stream) |
Redirects log output to given stream. More... | |
void | appendErrorTo (FILE *stream) |
Redirects error output to given stream. More... | |
void | setComm (MPI_Comm comm) |
Parallell comm. More... | |
void | writeLogMsg (logLevelType level, const char *format,...) |
Writes the normal log message. More... | |
void | writeELogMsg (logLevelType level, const char *_func, const char *_file, int _line, const char *format,...) |
Writes extended log message with file and line info. More... | |
void | flush () |
Flushes the log stream. More... | |
void | setLogLevel (logLevelType level) |
Sets log level to given one. Only log messages with level less or equal given threshold will be printed. More... | |
void | setLogLevel (int level) |
Sets log level to given one. Only log messages with level less or equal given threshold will be printed. More... | |
void | printStatistics () |
Prints number of errors and warning logged. More... | |
Protected Member Functions | |
const char * | giveLevelName (logLevelType l) const |
Protected Attributes | |
FILE * | logStream |
Stream used for logging. More... | |
FILE * | errStream |
bool | closeFlag |
flag indicating whether to close mylogStream. More... | |
bool | errCloseFlag |
logLevelType | logLevel |
Current log level, messages with higher level are not reported. More... | |
int | numberOfWrn |
Counter of all warning and error messages. More... | |
int | numberOfErr |
MPI_Comm | comm |
Parallell comm. More... | |
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 | ) |
oofem::Logger::~Logger | ( | ) |
void oofem::Logger::appendErrorTo | ( | const std::string & | fname | ) |
Redirects error output to given file name (with path).
Definition at line 181 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 216 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 162 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 200 of file logger.C.
References closeFlag, logStream, and OOFEM_ERROR.
|
inline |
|
protected |
Definition at line 300 of file logger.C.
References LOG_LEVEL_ERROR, and LOG_LEVEL_WARNING.
Referenced by writeELogMsg().
void oofem::Logger::printStatistics | ( | ) |
Prints number of errors and warning logged.
Definition at line 332 of file logger.C.
References comm, logStream, numberOfErr, and numberOfWrn.
void oofem::Logger::setComm | ( | MPI_Comm | comm | ) |
|
inline |
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 316 of file logger.C.
References LOG_LEVEL_DEBUG, LOG_LEVEL_FATAL, and logLevel.
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 265 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 print_stacktrace().
Referenced by oofem::ContextIOERR::print(), oofem::OOFEMTXTInputRecord::report_error(), and oofem::DynamicInputRecord::report_error().
void oofem::Logger::writeLogMsg | ( | logLevelType | level, |
const char * | format, | ||
... | |||
) |
Writes the normal log message.
Definition at line 234 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 72 of file logger.h.
Referenced by appendLogTo(), and ~Logger().
|
protected |
Parallell comm.
Definition at line 79 of file logger.h.
Referenced by printStatistics(), setComm(), and writeLogMsg().
|
protected |
Definition at line 72 of file logger.h.
Referenced by appendErrorTo(), and ~Logger().
|
protected |
Definition at line 70 of file logger.h.
Referenced by appendErrorTo(), writeELogMsg(), writeLogMsg(), and ~Logger().
|
protected |
Current log level, messages with higher level are not reported.
Definition at line 74 of file logger.h.
Referenced by setLogLevel(), writeELogMsg(), and writeLogMsg().
|
protected |
Stream used for logging.
Definition at line 70 of file logger.h.
Referenced by appendLogTo(), printStatistics(), writeELogMsg(), writeLogMsg(), and ~Logger().
|
protected |
Definition at line 76 of file logger.h.
Referenced by printStatistics(), writeELogMsg(), and writeLogMsg().
|
protected |
Counter of all warning and error messages.
Definition at line 76 of file logger.h.
Referenced by printStatistics(), writeELogMsg(), and writeLogMsg().