CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
ThreadSafeErrorLog.h
Go to the documentation of this file.
1 #ifndef THREADSAFEERRORLOG_H
2 #define FWCore_MessageService_ThreadSafeErrorLog_h
3 
4 // ----------------------------------------------------------------------
5 //
6 // ThreadSafeErrorLog provides interface to the module-wide variable by which
7 // users issue log messages, but utilizes a user-supplied
8 // mutex class to do the work in a thread-safe fashion.
9 //
10 // 5/29/01 mf Created file.
11 //
12 // Each thread (or each entitiy that could in principle be building up
13 // an error message) should have its own ThreadSafeErrorLog so that
14 // composition of multiple messages simultaneously will not lead to
15 // jumbled log output.
16 //
17 // ----------------------------------------------------------------------
18 
19 
20 
22 
23 namespace edm {
24 namespace service {
25 
26 
27 // ----------------------------------------------------------------------
28 // Prerequisite classes:
29 // ----------------------------------------------------------------------
30 
31 class ELadministrator;
32 class ELdestControl;
33 
34 
35 // ----------------------------------------------------------------------
36 // ThreadSafeErrorLog:
37 // ----------------------------------------------------------------------
38 
39 template <class Mutex>
41 
42  // Mutex represents the user-defined locking mechanism, which must
43  // work as follows: Any instance of a Mutex will when constructed
44  // obtain the right-to-log-an-error semaphore, and will relinquish
45  // that right when it is destructed.
46 
47 public:
48 
49 // ----------------------------------------------------------------------
50 // ----- Methods for physicists logging errors:
51 // ----------------------------------------------------------------------
52 
53  // ----- start a new logging operation:
54  //
55  inline ThreadSafeErrorLog & operator()
56  ( const ELseverityLevel & sev, const ELstring & id );
57 
58  inline ErrorLog & operator()( int debugLevel );
59 
60  // ----- mutator:
61  //
63 
64  // ----- logging operations:
65  //
66 
67  inline ThreadSafeErrorLog & emitToken(const ELstring & s);
68  // accumulate one part of a message
69 
71  // an entire message
72 
73  inline ThreadSafeErrorLog & completeMsg(); // no more parts forthcoming
74 
75 // ----------------------------------------------------------------------
76 // ----- Methods meant for the Module base class in the framework:
77 // ----------------------------------------------------------------------
78 
79  // ----- birth/death:
80  //
81  inline ThreadSafeErrorLog();
82  inline ThreadSafeErrorLog( const ELstring & pkgName );
83  inline ThreadSafeErrorLog( const ErrorLog & ee );
84  inline ThreadSafeErrorLog( const ThreadSafeErrorLog<Mutex> & ee );
85  inline virtual ~ThreadSafeErrorLog();
86 
87  // ----- mutators:
88  //
89  using ELtsErrorLog::setModule; // These two are
90  using ELtsErrorLog::setPackage; // IDENTICAL
91 
93  // Unlike ErrorLog, ThreadSafeErrorLog can have a process name
94  // distinct from that found in the ELadministrator
95 
96  // ----- logging collected message:
97  //
98  inline ThreadSafeErrorLog & operator()( int nbytes, char * data );
99 
100  // ----- advanced control options:
101 
107 
108  // ----- No member data; it is all held by ELtsErrorLog
109 
110 }; // ThreadSafeErrorLog
111 
112 // ----------------------------------------------------------------------
113 // Global functions:
114 // ----------------------------------------------------------------------
115 
116 template <class Mutex>
117 inline ThreadSafeErrorLog<Mutex> & operator<<
118  ( ThreadSafeErrorLog<Mutex> & e, void (* f)(ErrorLog &) );
119  // allow log << endmsg
120  // SAME arg. signature as for ErrorLog
121 
122 template <class Mutex, class T>
124  operator<<( ThreadSafeErrorLog<Mutex> & e, const T & t );
125 
126 // ----------------------------------------------------------------------
127 
128 
129 } // end of namespace service
130 } // end of namespace edm
131 
132 
133 // ----------------------------------------------------------------------
134 // .icc
135 // ----------------------------------------------------------------------
136 
137 #define THREADSAFEERRORLOG_ICC
138  #include "FWCore/MessageLogger/interface/ThreadSafeErrorLog.icc"
139 #undef THREADSAFEERRORLOG_ICC
140 
141 
142 // ----------------------------------------------------------------------
143 
144 
145 #endif // THREADSAFEERRORLOG_H
ThreadSafeErrorLog & operator()(const ELseverityLevel &sev, const ELstring &id)
ThreadSafeErrorLog & completeMsg()
ThreadSafeErrorLog & emitToken(const ELstring &s)
void setDebugVerbosity(int debugVerbosity)
void setPackage(const ELstring &pkgName)
ELseverityLevel setDiscardThreshold(ELseverityLevel sev)
bool getELdestControl(const ELstring &name, ELdestControl &theDestControl) const
int setHexTrigger(int trigger)
void setProcess(const ELstring &procName)
void setDebugMessages(ELseverityLevel sev, ELstring id)
void setSubroutine(const ELstring &subName)
double f[11][100]
void setModule(const ELstring &modName)
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
long double T
std::string ELstring
Definition: ELstring.h:26