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 )
29 : errorobj_p( new ErrorObj(sev,id,verbatim) )
30 {
31  //std::cout << "MessageSender ctor; new ErrorObj at: " << errorobj_p << '\n';
32 }
33 
35  ELstring const & id )
36 : errorobj_p( new ErrorObj(sev,id,false) )
37 {
38  //std::cout << "MessageSender ctor; new ErrorObj at: " << errorobj_p << '\n';
39 }
40 
41 
42 // This destructor must not be permitted to throw. A
43 // boost::thread_resoruce_error is thrown at static destruction time,
44 // if the MessageLogger library is loaded -- even if it is not used.
46 {
47  try
48  {
49  //std::cout << "MessageSender dtor; ErrorObj at: " << errorobj_p << '\n';
50 
51  // surrender ownership of our ErrorObj, transferring ownership
52  // (via the intermediate MessageLoggerQ) to the MessageLoggerScribe
53  // that will (a) route the message text to its destination(s)
54  // and will then (b) dispose of the ErrorObj
55 
57  if (drop) {
58  errorobj_p->setModule(drop->moduleContext()); // change log
60  }
61 #ifdef TRACE_DROP
62  if (!drop) std::cerr << "MessageSender::~MessageSender() - Null drop pointer \n";
63 #endif
64  // change log 1
67  {
68  ELextendedID const & xid = errorobj_p->xid();
69  ErrorSummaryMapKey key (xid.id, xid.module, xid.severity);
71  if (i != errorSummaryMap.end()) {
72  ++(i->second); // same as ++errorSummaryMap[key]
73  } else {
74  errorSummaryMap[key] = 1;
75  }
76  freshError = true;
77  }
78 
80  }
81  catch ( ... )
82  {
83  // nothing to do
84 
85  // for test that removal of thread-involved static works,
86  // simply throw here, then run in trivial_main in totalview
87  // and Next or Step so that the exception would be detected.
88  // That test has been done 12/14/07.
89  }
90 }
int i
Definition: DBlmapReader.cc:9
ELseverityLevel severity
Definition: ELextendedID.h:36
static MessageDrop * instance()
Definition: MessageDrop.cc:65
std::map< ErrorSummaryMapKey, unsigned int >::iterator ErrorSummaryMapIterator
Definition: MessageSender.h:24
ELslProxy< ELwarningGen > const ELwarning
static bool errorSummaryIsBeingKept
Definition: MessageSender.h:47
virtual void setContext(const ELstring &context)
Definition: ErrorObj.cc:170
const ELextendedID & xid() const
Definition: ErrorObj.cc:126
static bool freshError
Definition: MessageSender.h:48
static std::map< ErrorSummaryMapKey, unsigned int > errorSummaryMap
Definition: MessageSender.h:49
std::string moduleContext()
Definition: MessageDrop.cc:246
MessageSender(ELseverityLevel const &sev, ELstring const &id, bool verbatim)
const int drop
ErrorObj * errorobj_p
Definition: MessageSender.h:57
static void MLqLOG(ErrorObj *p)
list key
Definition: combine.py:13
std::string runEvent
Definition: MessageDrop.h:97
std::string ELstring
Definition: ELstring.h:26
virtual void setModule(const ELstring &module)
Definition: ErrorObj.cc:168