104 static char const dummy[] =
"dd-Mon-yyyy hh:mm:ss TZN ";
105 char ts[
sizeof(dummy)];
109 strftime( ts,
sizeof(dummy),
"%d-%b-%Y %H:%M:%S %Z", localtime_r(&t, &timebuf) );
112 #ifdef STRIP_TRAILING_BLANKS_IN_TIMEZONE
115 unsigned int b = strlen(ts);
116 while (ts[--b] ==
' ') {ts[
b] = 0;}
133 , wantTimestamp (
true )
134 , wantModule (
true )
135 , wantSubroutine (
true )
137 , wantSomeContext (
true )
138 , wantSerial (
false )
139 , wantFullContext (
false )
140 , wantTimeSeparate (
false )
141 , wantEpilogueSeparate(
false )
142 , preambleMode (
true )
145 #ifdef ELoutputCONSTRUCTOR_TRACE
146 std::cerr <<
"Constructor for ELoutput()\n";
149 emitToken(
"\n=================================================",
true );
150 emitToken(
"\nMessage Log File written by MessageLogger service \n" );
151 emitToken(
"\n=================================================\n",
true );
161 , wantTimestamp (
true )
162 , wantModule (
true )
163 , wantSubroutine (
true )
165 , wantSomeContext (
true )
166 , wantSerial (
false )
167 , wantFullContext (
false )
168 , wantTimeSeparate (
false )
169 , wantEpilogueSeparate(
false )
170 , preambleMode (
true )
173 #ifdef ELoutputCONSTRUCTOR_TRACE
174 std::cerr <<
"Constructor for ELoutput( os )\n";
180 emitToken(
"\n=================================================",
true );
181 emitToken(
"\nMessage Log File written by MessageLogger service \n" );
182 emitToken(
"\n=================================================\n",
true );
190 , os ( new std::ofstream( fileName.c_str() , std::ios::app),
close_and_delete())
193 , wantTimestamp (
true )
194 , wantModule (
true )
195 , wantSubroutine (
true )
197 , wantSomeContext (
true )
198 , wantSerial (
false )
199 , wantFullContext (
false )
200 , wantTimeSeparate (
false )
201 , wantEpilogueSeparate(
false )
202 , preambleMode (
true )
205 #ifdef ELoutputCONSTRUCTOR_TRACE
206 std::cerr <<
"Constructor for ELoutput( " << fileName <<
" )\n";
211 #ifdef ELoutputCONSTRUCTOR_TRACE
212 std::cerr <<
" Testing if os is owned\n";
214 #ifdef ELoutputCONSTRUCTOR_TRACE
215 std::cerr <<
" About to do first emit\n";
219 emitToken(
"\n=======================================================",
227 #ifdef ELoutputCONSTRUCTOR_TRACE
231 #ifdef ELoutputCONSTRUCTOR_TRACE
235 emitToken(
"\n=======================================================",
237 emitToken(
"\n%MSG** Logging to cerr is being substituted" );
238 emitToken(
" for specified log file \"" );
240 emitToken(
"\" which could not be opened for write or append.\n" );
246 emitToken(
"\n=======================================================\n",
251 #ifdef ELoutputCONSTRUCTOR_TRACE
252 std::cerr <<
"Constructor for ELoutput completed.\n";
261 , charsOnLine ( orig.charsOnLine )
263 , wantTimestamp ( orig.wantTimestamp )
264 , wantModule ( orig.wantModule )
265 , wantSubroutine ( orig.wantSubroutine )
266 , wantText ( orig.wantText )
267 , wantSomeContext ( orig.wantSomeContext )
268 , wantSerial ( orig.wantSerial )
269 , wantFullContext ( orig.wantFullContext )
270 , wantTimeSeparate ( orig.wantTimeSeparate )
271 , wantEpilogueSeparate( orig.wantEpilogueSeparate )
272 , preambleMode ( orig.preambleMode )
275 #ifdef ELoutputCONSTRUCTOR_TRACE
276 std::cerr <<
"Copy constructor for ELoutput\n";
298 #ifdef ELoutputCONSTRUCTOR_TRACE
299 std::cerr <<
"Destructor for ELoutput\n";
321 #ifdef ELoutputTRACE_LOG
322 std::cerr <<
" =:=:=: Log to an ELoutput \n";
328 std::cerr <<
" =:=:=: Log to an ELoutput \n"
331 <<
" id = " <<
xid.
id <<
"\n";
345 #ifdef ELoutputTRACE_LOG
346 std::cerr <<
" =:=:=: Limits table work done \n";
363 #ifdef ELoutputTRACE_LOG
371 std::ostringstream
s;
377 #ifdef OUTPUT_FORMATTED_ERROR_MESSAGES
381 ELlist_string::const_iterator it;
382 for ( it = msg.
items().begin(); it != msg.
items().end(); ++it ) {
383 #ifdef ELoutputTRACE_LOG
384 std::cerr <<
" =:=:=: Item: " << *it <<
'\n';
393 bool needAspace =
true;
416 #ifdef ELoutputTRACE_LOG
417 std::cerr <<
" =:=:=: Module and Subroutine done \n";
435 #ifdef ELoutputTRACE_LOG
436 std::cerr <<
" =:=:=: TimeStamp done \n";
446 #ifdef ELoutputTRACE_LOG
447 std::cerr <<
" =:=:=:>> context supplier is at 0x"
456 #ifdef ELoutputTRACE_LOG
457 std::cerr <<
" =:=:=: fullContext done: \n";
461 #ifdef ELoutputTRACE_LOG
479 , insertNewlineAfterHeader );
485 #ifdef ELoutputTRACE_LOG
486 std::cerr <<
" =:=:=: Trace routine done: \n";
489 #ifndef OUTPUT_FORMATTED_ERROR_MESSAGES
494 ELlist_string::const_iterator it;
496 for ( it = msg.
items().begin(); it != msg.
items().end(); ++it ) {
497 #ifdef ELoutputTRACE_LOG
498 std::cerr <<
" =:=:=: Item: " << *it <<
'\n';
502 if ( !insertNewlineAfterHeader && (item_count == 3) ) {
531 #ifdef ELoutputTRACE_LOG
532 std::cerr <<
" =:=:=: log(msg) done: \n";
548 #ifdef ELoutput_EMIT_TRACE
550 std::cerr <<
"[][][] in emit: s.length() " << s.length() <<
'\n';
554 if (s.length() == 0) {
556 (*os) <<
newline << std::flush;
566 second = (s.length() < 2) ?
'\0' : s[1];
567 last = (s.length() < 2) ?
'\0' : s[s.length()-1];
568 last2 = (s.length() < 3) ?
'\0' : s[s.length()-2];
575 || (charsOnLine + static_cast<int>(s.length())) >
lineLength ) {
576 #ifdef ELoutput_EMIT_TRACE
577 std::cerr <<
"[][][] in emit: about to << to *os \n";
579 #ifdef HEADERS_BROKEN_INTO_LINES_AND_INDENTED
582 charsOnLine = indent.length();
590 if ( first ==
'\n' ) {
591 (*os) << s.substr(1);
597 #ifdef ELoutput_EMIT_TRACE
598 std::cerr <<
"[][][] in emit: about to << s to *os: " << s <<
" \n";
604 if (last ==
'\n' || last2 ==
'\n') {
608 charsOnLine = indent.length() + 1;
611 if ( nl ) { (*os) <<
newline << std::flush; charsOnLine = 0; }
612 else { charsOnLine += s.length(); }
619 #ifdef ELoutput_EMIT_TRACE
620 std::cerr <<
"[][][] in emit: completed \n";
666 const int titleMaxLength( 40 );
698 emitToken(
"\n=======================================================",
true );
699 emitToken(
"\nError Log changed to this stream\n" );
702 emitToken(
"\n=======================================================\n",
true );
707 emitToken(
"\n=======================================================",
true );
708 emitToken(
"\nError Log changed to this file\n" );
711 emitToken(
"\n=======================================================\n",
true );
virtual ELoutput * clone() const
ELseverityLevel traceThreshold
const ELcontextSupplier & getContextSupplier() const
virtual void useFullContext()
const ELstring & idOverflow() const
virtual void separateTime()
virtual void changeFile(std::ostream &os)
ELslProxy< ELsuccessGen > const ELsuccess
virtual bool thisShouldBeIgnored(const ELstring &s) const
virtual void suppressSubroutine()
ELseverityLevel threshold
virtual void suppressContext()
virtual void includeSerial()
boost::shared_ptr< std::ostream > os
virtual void suppressTime()
U second(std::pair< T, U > const &p)
const ELstring getSymbol() const
virtual void attachEpilogue()
static ELstring formatTime(const time_t t)
const ELextendedID & xid() const
bool add(const ELextendedID &xid)
ELset_string respondToThese
virtual void includeSubroutine()
virtual void useContext()
virtual bool log(const edm::ErrorObj &msg)
virtual void includeContext()
virtual void suppressSerial()
virtual void includeTime()
virtual void separateEpilogue()
virtual ELstring context() const =0
virtual void attachTime()
const ELlist_string & items() const
ELslProxy< ELsevereGen > const ELsevere
virtual void emitToken(const ELstring &s, bool nl=false)
static ELadministrator * instance()
virtual void summarization(const ELstring &fullTitle, const ELstring &sumLines)
virtual void suppressModule()
bool respondToMostModules
virtual void suppressText()
virtual void includeText()
bool wantEpilogueSeparate
T first(std::pair< T, U > const &p)
virtual void includeModule()