1 #ifndef _ERROR_LOGGER_H_
2 #define _ERROR_LOGGER_H_
5 #include <boost/archive/basic_archive.hpp>
6 #include <boost/archive/text_iarchive.hpp>
7 #include <boost/archive/text_oarchive.hpp>
8 #include <boost/serialization/serialization.hpp>
9 #include <boost/serialization/list.hpp>
10 #include "mspass/utility/MsPASSError.h"
11 #include "mspass/utility/ErrorLogger.h"
20 std::string algorithm;
21 mspass::utility::ErrorSeverity badness;
38 LogData(
const int jid,
const std::string alg,
const std::string msg,
const mspass::utility::ErrorSeverity lvl);
39 friend std::ostream& operator<<(std::ostream&,
LogData&);
41 friend boost::serialization::access;
42 template<
class Archive>
43 void serialize(Archive& ar,
const unsigned int version)
69 void set_job_id(
int jid){job_id=jid;};
70 int get_job_id(){
return job_id;};
92 int log_error(
const std::string alg,
const std::string mess,
93 const mspass::utility::ErrorSeverity level);
102 int log_verbose(
const std::string alg,
const std::string mess);
103 std::list<LogData> get_error_log()
const{
return allmessages;};
104 int size()
const{
return allmessages.size();};
115 std::list<LogData> allmessages;
116 friend boost::serialization::access;
117 template<
class Archive>
118 void serialize(Archive& ar,
const unsigned int version)
137 template <
typename Tdata>
bool data_are_valid(
const Tdata& d)
139 if(d.dead())
return false;
140 std::list<LogData> welog;
141 welog=d.elog.worst_errors();
143 if(welog.size()<=0)
return true;
149 if(ld.badness == ErrorSeverity::Fatal || ld.badness == ErrorSeverity::Invalid)
Container to hold error logs for a data object.
Definition: ErrorLogger.h:61
ErrorLogger & operator+=(const ErrorLogger &parent)
Definition: ErrorLogger.cc:70
int log_verbose(const std::string alg, const std::string mess)
Log a verbose message marking it informational.
Definition: ErrorLogger.cc:94
std::list< LogData > worst_errors() const
Definition: ErrorLogger.cc:107
int log_error(const mspass::utility::MsPASSError &merr)
Definition: ErrorLogger.cc:81
void clear()
Definition: ErrorLogger.h:106
Definition: ErrorLogger.h:16
Base class for error object thrown by MsPASS library routines.
Definition: MsPASSError.h:40