File indexing completed on 2024-04-06 12:12:43
0001 #ifndef MessageLogger_ErrorObj_h
0002 #define MessageLogger_ErrorObj_h
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024 #include "FWCore/MessageLogger/interface/ELlist.h"
0025 #include "FWCore/MessageLogger/interface/ELextendedID.h"
0026 #include "FWCore/MessageLogger/interface/ELseverityLevel.h"
0027
0028 #include "fmt/format.h"
0029
0030 #include <sstream>
0031 #include <string>
0032
0033 namespace edm {
0034
0035
0036
0037
0038
0039 class ELcout;
0040
0041
0042
0043
0044
0045 class ErrorObj {
0046 public:
0047
0048
0049 ErrorObj(const messagelogger::ELseverityLevel& sev, std::string_view id, bool verbatim = false);
0050 ErrorObj(const ErrorObj& orig);
0051 virtual ~ErrorObj();
0052
0053 ErrorObj& operator=(const ErrorObj& other);
0054 void swap(ErrorObj& other);
0055
0056
0057 int serial() const;
0058 const ELextendedID& xid() const;
0059 const std::string& idOverflow() const;
0060 time_t timestamp() const;
0061 const ELlist_string& items() const;
0062 bool reactedTo() const;
0063 std::string fullText() const;
0064 const std::string& context() const;
0065 bool is_verbatim() const;
0066
0067
0068
0069 virtual void setSeverity(const messagelogger::ELseverityLevel& sev);
0070 virtual void setID(std::string_view ID);
0071 virtual void setModule(std::string_view module);
0072 virtual void setSubroutine(std::string_view subroutine);
0073 virtual void setContext(std::string_view context);
0074
0075
0076
0077 template <class T>
0078 inline ErrorObj& opltlt(const T& t);
0079 ErrorObj& opltlt(const char s[]);
0080 inline ErrorObj& operator<<(std::ostream& (*f)(std::ostream&));
0081 inline ErrorObj& operator<<(std::ios_base& (*f)(std::ios_base&));
0082 template <typename... Args>
0083 inline ErrorObj& format(fmt::format_string<Args...> format, Args&&... args);
0084 inline ErrorObj& vformat(std::string_view fmt, fmt::format_args args);
0085
0086 virtual ErrorObj& emitToken(std::string_view txt);
0087
0088
0089
0090 virtual void set(const messagelogger::ELseverityLevel& sev, std::string_view id);
0091 virtual void clear();
0092 virtual void setReactedTo(bool r);
0093
0094 private:
0095
0096
0097 int mySerial;
0098 ELextendedID myXid;
0099 std::string myIdOverflow;
0100 time_t myTimestamp;
0101 ELlist_string myItems;
0102 bool myReactedTo;
0103 std::string myContext;
0104 std::ostringstream myOs;
0105 std::string emptyString;
0106 bool verbatim;
0107
0108 };
0109
0110
0111
0112
0113
0114 template <class T>
0115 inline ErrorObj& operator<<(ErrorObj& e, const T& t);
0116
0117 ErrorObj& operator<<(ErrorObj& e, const char s[]);
0118
0119
0120
0121
0122
0123
0124
0125 inline void swap(ErrorObj& a, ErrorObj& b) { a.swap(b); }
0126
0127 }
0128
0129
0130
0131
0132
0133
0134
0135 #define ERROROBJ_ICC
0136 #include "FWCore/MessageLogger/interface/ErrorObj.icc"
0137 #undef ERROROBJ_ICC
0138
0139
0140
0141 #endif