1#ifndef _ERROR_LOGGER_H_
2#define _ERROR_LOGGER_H_
3#include "mspass/utility/ErrorLogger.h"
4#include "mspass/utility/MsPASSError.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/list.hpp>
9#include <boost/serialization/serialization.hpp>
18 std::string algorithm;
19 mspass::utility::ErrorSeverity badness;
28 LogData(
const int jid,
const std::string alg,
37 LogData(
const int jid,
const std::string alg,
const std::string msg,
38 const mspass::utility::ErrorSeverity lvl);
39 friend std::ostream &operator<<(std::ostream &,
LogData &);
42 friend boost::serialization::access;
43 template <
class Archive>
44 void serialize(Archive &ar,
const unsigned int version) {
65 void set_job_id(
int jid) { job_id = jid; };
66 int get_job_id() {
return job_id; };
88 int log_error(
const std::string alg,
const std::string mess,
89 const mspass::utility::ErrorSeverity level);
98 int log_verbose(
const std::string alg,
const std::string mess);
99 std::list<LogData> get_error_log()
const {
return allmessages; };
100 int size()
const {
return allmessages.size(); };
102 void clear() { allmessages.clear(); };
112 std::list<LogData> allmessages;
113 friend boost::serialization::access;
114 template <
class Archive>
115 void serialize(Archive &ar,
const unsigned int version) {
133template <
typename Tdata>
bool data_are_valid(
const Tdata &d) {
136 std::list<LogData> welog;
137 welog = d.elog.worst_errors();
139 if (welog.size() <= 0)
145 ld = *(welog.begin());
146 if (ld.badness == ErrorSeverity::Fatal ||
147 ld.badness == ErrorSeverity::Invalid)
Container to hold error logs for a data object.
Definition ErrorLogger.h:60
ErrorLogger & operator+=(const ErrorLogger &parent)
Definition ErrorLogger.cc:63
int log_verbose(const std::string alg, const std::string mess)
Log a verbose message marking it informational.
Definition ErrorLogger.cc:84
std::list< LogData > worst_errors() const
Definition ErrorLogger.cc:96
int log_error(const mspass::utility::MsPASSError &merr)
Definition ErrorLogger.cc:72
void clear()
Definition ErrorLogger.h:102
Definition ErrorLogger.h:14
Base class for error object thrown by MsPASS library routines.
Definition MsPASSError.h:38