CMS 3D CMS Logo

MessageLogger.cc
Go to the documentation of this file.
3 
4 // Change Log
5 //
6 // 12/12/07 mf elimination of dummyLogDebugObject_, dummyLogTraceObject_
7 // (see change log 8 in MessageLogger.h)
8 //
9 // 12/14/07 mf Moved the static free function onlyLowestDirectory
10 // to a class member function of LogDebug_, changing
11 // name to a more descriptive stripLeadingDirectoryTree.
12 // Cures the 2600-copies-of-this-function complaint.
13 // Implementation of this is moved into this .cc file.
14 //
15 // 6/20/08 mf Have flushMessageLog() check messageLoggerScribeIsRunning
16 // (in the message drop) to avoid hangs if that thread is not
17 // around.
18 //
19 // 11/18/08 wmtan Use explicit non-inlined destructors
20 //
21 // 8/11/09 mf setStandAloneMessageThreshold() and
22 // squelchStandAloneMessageCategory()
23 //
24 // 10/29/09 wmtan Use explicit non-inlined constructors for LogDebug_
25 // and LogTrace_
26 //
27 // 8/11/09 mf setStandAloneMessageThreshold() and
28 // squelchStandAloneMessageCategory()
29 //
30 // 9/23/10 mf Initialize debugEnabled according to
31 // MessageDrop::debugAlwaysSuppressed, rather than
32 // just true. See change 21 of MessageLogger.h.
33 //
34 // 9/27/10 mf isDebugEnabled() - check that debugAlwaysSuppressed is
35 // false before examining debugEnabled, which in principle
36 // ought to be thread-specific thus more expensive to look at.
37 //
38 // 9/27/10b mf dtor for LogWarningThatSuppressesLikeLogInfo - see
39 // change log 22 in MessageLogger.h
40 //
41 // 11/30/10 mf SnapshotMessageLog() method to force MessageDrop to capture any
42 // pointed-to strings in anticipation of key objects going
43 // away before a message is going to be issued.
44 //
45 //
46 // 7/6/11 fwyzard Add support for discarding LogError-level messages
47 // on a per-module basis (needed at HLT)
48 // ------------------------------------------------------------------------
49 
50 namespace edm {
51 
63  namespace edmmltest { // 9/27/10b mf
64  LogWarningThatSuppressesLikeLogInfo::~LogWarningThatSuppressesLikeLogInfo() {}
65  } // namespace edmmltest
66 
67  void LogStatistics() {
68  edm::MessageLoggerQ::MLqSUM(); // trigger summary info
69  }
70 
71  bool isDebugEnabled() {
72  return ((!edm::MessageDrop::debugAlwaysSuppressed) // 9/27/10 mf
73  && edm::MessageDrop::instance()->debugEnabled);
74  }
75 
76  bool isInfoEnabled() {
77  return ((!edm::MessageDrop::infoAlwaysSuppressed) // 9/27/10 mf
78  && edm::MessageDrop::instance()->infoEnabled);
79  }
80 
82  return ((!edm::MessageDrop::warningAlwaysSuppressed) // 9/27/10 mf
83  && edm::MessageDrop::instance()->warningEnabled);
84  }
85 
86  bool isErrorEnabled() {
87  return edm::MessageDrop::instance()->errorEnabled; // 7/6/11 fwyzard
88  }
89 
91  edm::MessageLoggerQ::MLqSHT(); // Shut the logger up
92  }
93 
94  void FlushMessageLog() {
95  if (MessageDrop::instance()->messageLoggerScribeIsRunning != MLSCRIBE_RUNNING_INDICATOR)
96  return; // 6/20/08 mf
97  edm::MessageLoggerQ::MLqFLS(); // Flush the message log queue
98  }
99 
100  void clearMessageLog() { // 11/30/10 mf
102  }
103 
104  bool isMessageProcessingSetUp() { // 6/20/08 mf
105  // std::cerr << "isMessageProcessingSetUp: \n";
106  // std::cerr << "messageLoggerScribeIsRunning = "
107  // << (int)MessageDrop::instance()->messageLoggerScribeIsRunning << "\n";
108  return (MessageDrop::instance()->messageLoggerScribeIsRunning == MLSCRIBE_RUNNING_INDICATOR);
109  }
110 
112  std::string* cat_p = new std::string(category);
113  edm::MessageLoggerQ::MLqGRP(cat_p); // Indicate a group summary category
114  // Note that the scribe will be responsible for deleting cat_p
115  }
116 
118  *this << " " << stripLeadingDirectoryTree(file) << ":" << line << "\n";
119  }
120 
122  std::string::size_type lastSlash = file.find_last_of('/');
123  if (lastSlash == std::string::npos)
124  return file;
125  if (lastSlash == file.size() - 1)
126  return file;
127  return file.substr(lastSlash + 1, file.size() - lastSlash - 1);
128  }
129 
131 
134  }
136 
137 } // namespace edm
ELslProxy< ELdebugGen > const ELdebug
MessageSender ap
bool isDebugEnabled()
bool isWarningEnabled()
void FlushMessageLog()
void HaltMessageLogging()
static MessageDrop * instance()
Definition: MessageDrop.cc:59
MessageSender ap
bool isMessageProcessingSetUp()
bool isErrorEnabled()
uint16_t size_type
static const unsigned char MLSCRIBE_RUNNING_INDICATOR
Definition: MessageDrop.h:119
void setStandAloneMessageThreshold(edm::ELseverityLevel const &severity)
static bool debugAlwaysSuppressed
Definition: MessageDrop.h:109
static void squelch(std::string const &category)
void GroupLogStatistics(std::string const &category)
static void MLqFLS()
void squelchStandAloneMessageCategory(std::string const &category)
static bool warningAlwaysSuppressed
Definition: MessageDrop.h:111
void LogStatistics()
void clearMessageLog()
static void MLqGRP(std::string *cat_p)
bool isInfoEnabled()
HLT enums.
static void standAloneThreshold(edm::ELseverityLevel const &severity)
static void MLqSUM()
static bool infoAlwaysSuppressed
Definition: MessageDrop.h:110
std::string stripLeadingDirectoryTree(const std::string &file) const
static void MLqSHT()