CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
MessageSender.cc
Go to the documentation of this file.
4 
5 #define TRACE_DROP
6 #ifdef TRACE_DROP
7 #include <iostream>
8 #endif
9 
10 // Change log
11 //
12 // 1 mf 8/25/08 keeping the error summary information for
13 // LoggedErrorsSummary()
14 //
15 // 2 mf 11/2/10 Use new moduleContext method of MessageDrop:
16 // see MessageServer/src/MessageLogger.cc change 17.
17 //
18 
19 
20 using namespace edm;
21 
22 bool MessageSender::errorSummaryIsBeingKept = false; // change log 1
23 bool MessageSender::freshError = false;
24 std::map<ErrorSummaryMapKey, unsigned int> MessageSender::errorSummaryMap;
25 
27  ELstring const & id,
28  bool verbatim, bool suppressed )
29 : errorobj_p( suppressed ? 0 : new ErrorObj(sev,id,verbatim), ErrorObjDeleter())
30 {
31  //std::cout << "MessageSender ctor; new ErrorObj at: " << errorobj_p << '\n';
32 }
33 
34 
35 // This destructor must not be permitted to throw. A
36 // boost::thread_resoruce_error is thrown at static destruction time,
37 // if the MessageLogger library is loaded -- even if it is not used.
39  if (errorObjPtr == 0) {
40  return;
41  }
42  try
43  {
44  //std::cout << "MessageSender dtor; ErrorObj at: " << errorobj_p << '\n';
45 
46  // surrender ownership of our ErrorObj, transferring ownership
47  // (via the intermediate MessageLoggerQ) to the MessageLoggerScribe
48  // that will (a) route the message text to its destination(s)
49  // and will then (b) dispose of the ErrorObj
50 
52  if (drop) {
53  errorObjPtr->setModule(drop->moduleContext()); // change log
54  errorObjPtr->setContext(drop->runEvent);
55  }
56 #ifdef TRACE_DROP
57  if (!drop) std::cerr << "MessageSender::~MessageSender() - Null drop pointer \n";
58 #endif
59  // change log 1
61  errorObjPtr->xid().severity >= ELwarning )
62  {
63  ELextendedID const & xid = errorObjPtr->xid();
64  ErrorSummaryMapKey key (xid.id, xid.module, xid.severity);
66  if (i != errorSummaryMap.end()) {
67  ++(i->second); // same as ++errorSummaryMap[key]
68  } else {
69  errorSummaryMap[key] = 1;
70  }
71  freshError = true;
72  }
73 
74  MessageLoggerQ::MLqLOG(errorObjPtr);
75  }
76  catch ( ... )
77  {
78  // nothing to do
79 
80  // for test that removal of thread-involved static works,
81  // simply throw here, then run in trivial_main in totalview
82  // and Next or Step so that the exception would be detected.
83  // That test has been done 12/14/07.
84  }
85 }
87 {
88 }
int i
Definition: DBlmapReader.cc:9
ELseverityLevel severity
Definition: ELextendedID.h:36
static MessageDrop * instance()
Definition: MessageDrop.cc:65
void operator()(ErrorObj *errorObjPtr)
std::map< ErrorSummaryMapKey, unsigned int >::iterator ErrorSummaryMapIterator
Definition: MessageSender.h:30
ELslProxy< ELwarningGen > const ELwarning
static bool errorSummaryIsBeingKept
Definition: MessageSender.h:57
virtual void setContext(const ELstring &context)
Definition: ErrorObj.cc:190
const ELextendedID & xid() const
Definition: ErrorObj.cc:146
static bool freshError
Definition: MessageSender.h:58
static std::map< ErrorSummaryMapKey, unsigned int > errorSummaryMap
Definition: MessageSender.h:59
std::string moduleContext()
Definition: MessageDrop.cc:261
const int drop
static void MLqLOG(ErrorObj *p)
list key
Definition: combine.py:13
std::string runEvent
Definition: MessageDrop.h:102
std::string ELstring
Definition: ELstring.h:26
virtual void setModule(const ELstring &module)
Definition: ErrorObj.cc:188