102 static char const dummy[] =
"dd-Mon-yyyy hh:mm:ss TZN ";
103 char ts[
sizeof(dummy)];
107 strftime( ts,
sizeof(dummy),
"%d-%b-%Y %H:%M:%S %Z", localtime_r(&t, &timebuf) );
110 #ifdef STRIP_TRAILING_BLANKS_IN_TIMEZONE
113 unsigned int b = strlen(ts);
114 while (ts[--b] ==
' ') {ts[
b] = 0;}
131 , wantTimestamp (
true )
132 , wantModule (
true )
133 , wantSubroutine (
true )
135 , wantSomeContext (
true )
136 , wantSerial (
false )
137 , wantFullContext (
false )
138 , wantTimeSeparate (
false )
139 , wantEpilogueSeparate(
false )
140 , preambleMode (
true )
143 #ifdef ELoutputCONSTRUCTOR_TRACE
144 std::cerr <<
"Constructor for ELoutput()\n";
147 emitToken(
"\n=================================================",
true );
148 emitToken(
"\nMessage Log File written by MessageLogger service \n" );
149 emitToken(
"\n=================================================\n",
true );
159 , wantTimestamp (
true )
160 , wantModule (
true )
161 , wantSubroutine (
true )
163 , wantSomeContext (
true )
164 , wantSerial (
false )
165 , wantFullContext (
false )
166 , wantTimeSeparate (
false )
167 , wantEpilogueSeparate(
false )
168 , preambleMode (
true )
171 #ifdef ELoutputCONSTRUCTOR_TRACE
172 std::cerr <<
"Constructor for ELoutput( os )\n";
178 emitToken(
"\n=================================================",
true );
179 emitToken(
"\nMessage Log File written by MessageLogger service \n" );
180 emitToken(
"\n=================================================\n",
true );
188 , os ( new std::ofstream( fileName.c_str() , std::ios::app),
close_and_delete())
191 , wantTimestamp (
true )
192 , wantModule (
true )
193 , wantSubroutine (
true )
195 , wantSomeContext (
true )
196 , wantSerial (
false )
197 , wantFullContext (
false )
198 , wantTimeSeparate (
false )
199 , wantEpilogueSeparate(
false )
200 , preambleMode (
true )
203 #ifdef ELoutputCONSTRUCTOR_TRACE
204 std::cerr <<
"Constructor for ELoutput( " << fileName <<
" )\n";
209 #ifdef ELoutputCONSTRUCTOR_TRACE
210 std::cerr <<
" Testing if os is owned\n";
212 #ifdef ELoutputCONSTRUCTOR_TRACE
213 std::cerr <<
" About to do first emit\n";
217 emitToken(
"\n=======================================================",
225 #ifdef ELoutputCONSTRUCTOR_TRACE
229 #ifdef ELoutputCONSTRUCTOR_TRACE
233 emitToken(
"\n=======================================================",
235 emitToken(
"\n%MSG** Logging to cerr is being substituted" );
236 emitToken(
" for specified log file \"" );
238 emitToken(
"\" which could not be opened for write or append.\n" );
244 emitToken(
"\n=======================================================\n",
249 #ifdef ELoutputCONSTRUCTOR_TRACE
250 std::cerr <<
"Constructor for ELoutput completed.\n";
259 , charsOnLine ( orig.charsOnLine )
261 , wantTimestamp ( orig.wantTimestamp )
262 , wantModule ( orig.wantModule )
263 , wantSubroutine ( orig.wantSubroutine )
264 , wantText ( orig.wantText )
265 , wantSomeContext ( orig.wantSomeContext )
266 , wantSerial ( orig.wantSerial )
267 , wantFullContext ( orig.wantFullContext )
268 , wantTimeSeparate ( orig.wantTimeSeparate )
269 , wantEpilogueSeparate( orig.wantEpilogueSeparate )
270 , preambleMode ( orig.preambleMode )
273 #ifdef ELoutputCONSTRUCTOR_TRACE
274 std::cerr <<
"Copy constructor for ELoutput\n";
296 #ifdef ELoutputCONSTRUCTOR_TRACE
297 std::cerr <<
"Destructor for ELoutput\n";
319 #ifdef ELoutputTRACE_LOG
320 std::cerr <<
" =:=:=: Log to an ELoutput \n";
326 std::cerr <<
" =:=:=: Log to an ELoutput \n"
329 <<
" id = " <<
xid.
id <<
"\n";
343 #ifdef ELoutputTRACE_LOG
344 std::cerr <<
" =:=:=: Limits table work done \n";
361 #ifdef ELoutputTRACE_LOG
369 std::ostringstream
s;
375 #ifdef OUTPUT_FORMATTED_ERROR_MESSAGES
379 ELlist_string::const_iterator it;
380 for ( it = msg.
items().begin(); it != msg.
items().end(); ++it ) {
381 #ifdef ELoutputTRACE_LOG
382 std::cerr <<
" =:=:=: Item: " << *it <<
'\n';
391 bool needAspace =
true;
414 #ifdef ELoutputTRACE_LOG
415 std::cerr <<
" =:=:=: Module and Subroutine done \n";
433 #ifdef ELoutputTRACE_LOG
434 std::cerr <<
" =:=:=: TimeStamp done \n";
446 #ifdef ELoutputTRACE_LOG
447 std::cerr <<
" =:=:=: fullContext done: \n";
451 #ifdef ELoutputTRACE_LOG
468 , insertNewlineAfterHeader );
474 #ifdef ELoutputTRACE_LOG
475 std::cerr <<
" =:=:=: Trace routine done: \n";
478 #ifndef OUTPUT_FORMATTED_ERROR_MESSAGES
483 ELlist_string::const_iterator it;
485 for ( it = msg.
items().begin(); it != msg.
items().end(); ++it ) {
486 #ifdef ELoutputTRACE_LOG
487 std::cerr <<
" =:=:=: Item: " << *it <<
'\n';
491 if ( !insertNewlineAfterHeader && (item_count == 3) ) {
520 #ifdef ELoutputTRACE_LOG
521 std::cerr <<
" =:=:=: log(msg) done: \n";
537 #ifdef ELoutput_EMIT_TRACE
539 std::cerr <<
"[][][] in emit: s.length() " << s.length() <<
'\n';
543 if (s.length() == 0) {
545 (*os) <<
newline << std::flush;
555 second = (s.length() < 2) ?
'\0' : s[1];
556 last = (s.length() < 2) ?
'\0' : s[s.length()-1];
557 last2 = (s.length() < 3) ?
'\0' : s[s.length()-2];
564 || (charsOnLine + static_cast<int>(s.length())) >
lineLength ) {
565 #ifdef ELoutput_EMIT_TRACE
566 std::cerr <<
"[][][] in emit: about to << to *os \n";
568 #ifdef HEADERS_BROKEN_INTO_LINES_AND_INDENTED
571 charsOnLine = indent.length();
579 if ( first ==
'\n' ) {
580 (*os) << s.substr(1);
586 #ifdef ELoutput_EMIT_TRACE
587 std::cerr <<
"[][][] in emit: about to << s to *os: " << s <<
" \n";
593 if (last ==
'\n' || last2 ==
'\n') {
597 charsOnLine = indent.length() + 1;
600 if ( nl ) { (*os) <<
newline << std::flush; charsOnLine = 0; }
601 else { charsOnLine += s.length(); }
608 #ifdef ELoutput_EMIT_TRACE
609 std::cerr <<
"[][][] in emit: completed \n";
655 const int titleMaxLength( 40 );
687 emitToken(
"\n=======================================================",
true );
688 emitToken(
"\nError Log changed to this stream\n" );
691 emitToken(
"\n=======================================================\n",
true );
696 emitToken(
"\n=======================================================",
true );
697 emitToken(
"\nError Log changed to this file\n" );
700 emitToken(
"\n=======================================================\n",
true );
virtual ELoutput * clone() const
ELslProxy< ELdebugGen > const ELdebug
ELseverityLevel traceThreshold
virtual void useFullContext()
const ELstring & idOverflow() const
virtual void separateTime()
virtual void changeFile(std::ostream &os)
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 void attachTime()
const ELlist_string & items() const
ELslProxy< ELsevereGen > const ELsevere
virtual void emitToken(const ELstring &s, bool nl=false)
virtual void summarization(const ELstring &fullTitle, const ELstring &sumLines)
virtual void suppressModule()
bool respondToMostModules
virtual void suppressText()
virtual void includeText()
bool wantEpilogueSeparate
volatile std::atomic< bool > shutdown_flag false
T first(std::pair< T, U > const &p)
virtual void includeModule()