version
0.0.1
Defines the C++ API for MsPASS
|
Container to hold error logs for a data object. More...
#include <ErrorLogger.h>
Public Member Functions | |
ErrorLogger (int job) | |
ErrorLogger (const ErrorLogger &parent) | |
void | set_job_id (int jid) |
int | get_job_id () |
int | log_error (const mspass::utility::MsPASSError &merr) |
int | log_error (const std::string alg, const std::string mess, const mspass::utility::ErrorSeverity level) |
int | log_verbose (const std::string alg, const std::string mess) |
Log a verbose message marking it informational. More... | |
std::list< LogData > | get_error_log () const |
int | size () const |
void | clear () |
ErrorLogger & | operator= (const ErrorLogger &parent) |
ErrorLogger & | operator+= (const ErrorLogger &parent) |
std::list< LogData > | worst_errors () const |
Container to hold error logs for a data object.
This class is intended mainly to be added to data objects in mspass to provide a scalable, thread safe method for logging errors. Atomic mspass data objects (e.g. seismograms and time series objects) all use this class to log errors and mark data with ambiguous states. The log can explain why data is an invalid state, but can also contain debug information normally enabled by something like a verbose option to a program.
|
inline |
int mspass::utility::ErrorLogger::log_error | ( | const mspass::utility::MsPASSError & | merr | ) |
Logs one error message.
merr | - many mspass procedures throw MsPASSError objects. This simplifies the process of posting them to an error log. |
int mspass::utility::ErrorLogger::log_error | ( | const std::string | alg, |
const std::string | mess, | ||
const mspass::utility::ErrorSeverity | level = ErrorSeverity::Invalid |
||
) |
Log one a message directly with a specified severity.
This is a convenience overload of log_error. It splits the MsPASSError components as arguments with a default that allows a default behavior of Invalid as the error state.
alg | is name of algorithm posting this message |
mess | is the message to be posted. |
level | is the badness level to be set with the message. (default is ErrorSeverity::Invalid). |
int mspass::utility::ErrorLogger::log_verbose | ( | const std::string | alg, |
const std::string | mess | ||
) |
Log a verbose message marking it informational.
Frequently programs need a verbose option to log something of interest that is not an error but potentially useful. This alternate logging method posts the string mess and marks it Informational. Returns the size of the log after insertion.
ErrorLogger & mspass::utility::ErrorLogger::operator+= | ( | const ErrorLogger & | parent | ) |
list< LogData > mspass::utility::ErrorLogger::worst_errors | ( | ) | const |
Return an std::list container with most serious error level marked.