CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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
65 }
66 
67 void LogStatistics() {
68  edm::MessageLoggerQ::MLqSUM ( ); // trigger summary info
69 }
70 
72  return ((!edm::MessageDrop::debugAlwaysSuppressed) // 9/27/10 mf
74 }
75 
76 bool isInfoEnabled() {
77  return ((!edm::MessageDrop::infoAlwaysSuppressed) // 9/27/10 mf
79 }
80 
82  return ((!edm::MessageDrop::warningAlwaysSuppressed) // 9/27/10 mf
84 }
85 
87  return edm::MessageDrop::errorEnabled; // 7/6/11 fwyzard
88 }
89 
91  edm::MessageLoggerQ::MLqSHT ( ); // Shut the logger up
92 }
93 
95  if (MessageDrop::instance()->messageLoggerScribeIsRunning !=
96  MLSCRIBE_RUNNING_INDICATOR) return; // 6/20/08 mf
97  edm::MessageLoggerQ::MLqFLS ( ); // Flush the message log queue
98 }
99 
100 void snapshotMessageLog() { // 11/30/10 mf
101  // Capture module name and label strings.
102  // Use if module objects are about to disappear due to exception,
103  // but a message will then be issued.
105 }
106 
107 bool isMessageProcessingSetUp() { // 6/20/08 mf
108 // std::cerr << "isMessageProcessingSetUp: \n";
109 // std::cerr << "messageLoggerScribeIsRunning = "
110 // << (int)MessageDrop::instance()->messageLoggerScribeIsRunning << "\n";
111  return (MessageDrop::instance()->messageLoggerScribeIsRunning ==
113 }
114 
115 void GroupLogStatistics(std::string const & category) {
116  std::string * cat_p = new std::string(category);
117  edm::MessageLoggerQ::MLqGRP (cat_p); // Indicate a group summary category
118  // Note that the scribe will be responsible for deleting cat_p
119 }
120 
121 edm::LogDebug_::LogDebug_( std::string const & id, std::string const & file, int line )
122  : ap( ELsuccess,id)
123 {
124  *this
125  << " "
127  << ":" << line << "\n";
128 }
129 
130 std::string
132  std::string::size_type lastSlash = file.find_last_of('/');
133  if (lastSlash == std::string::npos) return file;
134  if (lastSlash == file.size()-1) return file;
135  return file.substr(lastSlash+1, file.size()-lastSlash-1);
136 }
137 
138 edm::LogTrace_::LogTrace_( std::string const & id )
139  : ap( ELsuccess,id,true)
140  { }
141 
142 void setStandAloneMessageThreshold(std::string const & severity) {
144 }
145 void squelchStandAloneMessageCategory(std::string const & category){
147 }
148 
149 } // namespace edm
bool isDebugEnabled()
bool isWarningEnabled()
void FlushMessageLog()
static bool warningEnabled
Definition: MessageDrop.h:107
ELslProxy< ELsuccessGen > const ELsuccess
static void standAloneThreshold(std::string const &severity)
void HaltMessageLogging()
static MessageDrop * instance()
Definition: MessageDrop.cc:65
static bool debugEnabled
Definition: MessageDrop.h:105
bool isMessageProcessingSetUp()
bool isErrorEnabled()
uint16_t size_type
static const unsigned char MLSCRIBE_RUNNING_INDICATOR
Definition: MessageDrop.h:121
static bool debugAlwaysSuppressed
Definition: MessageDrop.h:111
static void squelch(std::string const &category)
void GroupLogStatistics(std::string const &category)
static bool infoEnabled
Definition: MessageDrop.h:106
static void MLqFLS()
void setStandAloneMessageThreshold(std::string const &severity)
void squelchStandAloneMessageCategory(std::string const &category)
static bool warningAlwaysSuppressed
Definition: MessageDrop.h:113
static bool errorEnabled
Definition: MessageDrop.h:108
void LogStatistics()
static void MLqGRP(std::string *cat_p)
bool isInfoEnabled()
static void MLqSUM()
static bool infoAlwaysSuppressed
Definition: MessageDrop.h:112
std::string stripLeadingDirectoryTree(const std::string &file) const
static void MLqSHT()
void snapshotMessageLog()