98 constexpr
char dummy[] =
"dd-Mon-yyyy hh:mm:ss TZN ";
99 char ts[
sizeof(dummy)];
103 strftime(ts,
sizeof(dummy),
"%d-%b-%Y %H:%M:%S %Z", localtime_r(&t, &timebuf));
106 #ifdef STRIP_TRAILING_BLANKS_IN_TIMEZONE
109 unsigned int b = strlen(ts);
110 while (ts[--b] ==
' ') {
119 using namespace edm::messagelogger;
133 wantSubroutine(
true),
135 wantSomeContext(
true),
137 wantFullContext(
false),
138 wantTimeSeparate(
false),
139 wantEpilogueSeparate(
false),
142 #ifdef ELoutputCONSTRUCTOR_TRACE
143 std::cerr <<
"Constructor for ELoutput()\n";
146 emitToken(
"\n=================================================",
true);
147 emitToken(
"\nMessage Log File written by MessageLogger service \n");
148 emitToken(
"\n=================================================\n",
true);
159 wantSubroutine(
true),
161 wantSomeContext(
true),
163 wantFullContext(
false),
164 wantTimeSeparate(
false),
165 wantEpilogueSeparate(
false),
168 #ifdef ELoutputCONSTRUCTOR_TRACE
169 std::cerr <<
"Constructor for ELoutput( os )\n";
175 emitToken(
"\n=================================================",
true);
176 emitToken(
"\nMessage Log File written by MessageLogger service \n");
177 emitToken(
"\n=================================================\n",
true);
184 os(new std::ofstream(fileName.c_str(), std::ios ::app),
close_and_delete()),
189 wantSubroutine(
true),
191 wantSomeContext(
true),
193 wantFullContext(
false),
194 wantTimeSeparate(
false),
195 wantEpilogueSeparate(
false),
198 #ifdef ELoutputCONSTRUCTOR_TRACE
199 std::cerr <<
"Constructor for ELoutput( " << fileName <<
" )\n";
204 #ifdef ELoutputCONSTRUCTOR_TRACE
205 std::cerr <<
" Testing if os is owned\n";
207 #ifdef ELoutputCONSTRUCTOR_TRACE
208 std::cerr <<
" About to do first emit\n";
212 emitToken(
"\n=======================================================",
true);
218 #ifdef ELoutputCONSTRUCTOR_TRACE
222 #ifdef ELoutputCONSTRUCTOR_TRACE
226 emitToken(
"\n=======================================================",
true);
227 emitToken(
"\n%MSG** Logging to cerr is being substituted");
230 emitToken(
"\" which could not be opened for write or append.\n");
234 std::string const& ftime = formatTime(time(
nullptr));
236 emitToken(
"\n=======================================================\n",
true);
240 #ifdef ELoutputCONSTRUCTOR_TRACE
241 std::cerr <<
"Constructor for ELoutput completed.\n";
249 charsOnLine(orig.charsOnLine),
251 wantTimestamp(orig.wantTimestamp),
252 wantModule(orig.wantModule),
253 wantSubroutine(orig.wantSubroutine),
254 wantText(orig.wantText),
255 wantSomeContext(orig.wantSomeContext),
256 wantSerial(orig.wantSerial),
257 wantFullContext(orig.wantFullContext),
258 wantTimeSeparate(orig.wantTimeSeparate),
259 wantEpilogueSeparate(orig.wantEpilogueSeparate),
260 preambleMode(orig.preambleMode)
262 #ifdef ELoutputCONSTRUCTOR_TRACE
263 std::cerr <<
"Copy constructor for ELoutput\n";
283 #ifdef ELoutputCONSTRUCTOR_TRACE
284 std::cerr <<
"Destructor for ELoutput\n";
297 #ifdef ELoutputTRACE_LOG
298 std::cerr <<
" =:=:=: Log to an ELoutput \n";
304 std::cerr <<
" =:=:=: Log to an ELoutput \n"
307 <<
" id = " <<
xid.
id <<
"\n";
320 #ifdef ELoutputTRACE_LOG
321 std::cerr <<
" =:=:=: Limits table work done \n";
338 #ifdef ELoutputTRACE_LOG
345 std::ostringstream
s;
351 #ifdef OUTPUT_FORMATTED_ERROR_MESSAGES
355 ELlist_string::const_iterator it;
356 for (it = msg.
items().begin(); it != msg.
items().end(); ++it) {
357 #ifdef ELoutputTRACE_LOG
358 std::cerr <<
" =:=:=: Item: " << *it <<
'\n';
367 bool needAspace =
true;
394 #ifdef ELoutputTRACE_LOG
395 std::cerr <<
" =:=:=: Module and Subroutine done \n";
415 #ifdef ELoutputTRACE_LOG
416 std::cerr <<
" =:=:=: TimeStamp done \n";
430 #ifdef ELoutputTRACE_LOG
431 std::cerr <<
" =:=:=: fullContext done: \n";
435 #ifdef ELoutputTRACE_LOG
450 emitToken(
"\n", insertNewlineAfterHeader);
455 #ifdef ELoutputTRACE_LOG
456 std::cerr <<
" =:=:=: Trace routine done: \n";
459 #ifndef OUTPUT_FORMATTED_ERROR_MESSAGES
464 ELlist_string::const_iterator it;
466 for (it = msg.
items().begin(); it != msg.
items().end(); ++it) {
467 #ifdef ELoutputTRACE_LOG
468 std::cerr <<
" =:=:=: Item: " << *it <<
'\n';
472 if (!insertNewlineAfterHeader && (item_count == 3)) {
498 #ifdef ELoutputTRACE_LOG
499 std::cerr <<
" =:=:=: log(msg) done: \n";
513 #ifdef ELoutput_EMIT_TRACE
515 std::cerr <<
"[][][] in emit: s.length() " << s.length() <<
'\n';
519 if (s.length() == 0) {
521 (*os) <<
newline << std::flush;
529 second = (s.length() < 2) ?
'\0' : s[1];
530 last = (s.length() < 2) ?
'\0' : s[s.length() - 1];
531 last2 = (s.length() < 3) ?
'\0' : s[s.length() - 2];
537 if (first ==
'\n' || (charsOnLine + static_cast<int>(s.length())) >
lineLength) {
538 #ifdef ELoutput_EMIT_TRACE
539 std::cerr <<
"[][][] in emit: about to << to *os \n";
541 #ifdef HEADERS_BROKEN_INTO_LINES_AND_INDENTED
544 charsOnLine = indent.length();
553 (*os) << s.substr(1);
558 #ifdef ELoutput_EMIT_TRACE
559 std::cerr <<
"[][][] in emit: about to << s to *os: " << s <<
" \n";
565 if (last ==
'\n' || last2 ==
'\n') {
569 charsOnLine = indent.length() + 1;
573 (*os) <<
newline << std::flush;
576 charsOnLine += s.length();
584 #ifdef ELoutput_EMIT_TRACE
585 std::cerr <<
"[][][] in emit: completed \n";
627 emitToken(
"\n=======================================================",
true);
628 emitToken(
"\nError Log changed to this stream\n");
629 std::string const& ftime = formatTime(time(
nullptr));
631 emitToken(
"\n=======================================================\n",
true);
636 emitToken(
"\n=======================================================",
true);
637 emitToken(
"\nError Log changed to this file\n");
638 std::string const& ftime = formatTime(time(
nullptr));
640 emitToken(
"\n=======================================================\n",
true);
messagelogger::ELseverityLevel severity
std::unordered_set< std::string > ignoreThese
const std::string & getSymbol() const
void suppressText() override
const std::string & context() const
const std::string & idOverflow() const
void separateEpilogue() override
constexpr const ELseverityLevel ELsevere
U second(std::pair< T, U > const &p)
const ELextendedID & xid() const
void includeModule() override
void includeSubroutine() override
bool add(const ELextendedID &xid)
void includeContext() override
virtual bool thisShouldBeIgnored(std::string const &s) const
void attachEpilogue() override
void suppressSerial() override
std::unordered_set< std::string > respondToThese
void emitToken(std::string_view s, bool nl=false)
void separateTime() override
void suppressTime() override
std::shared_ptr< std::ostream > os
const ELlist_string & items() const
void useFullContext() override
void includeSerial() override
void attachTime() override
void suppressModule() override
void includeTime() override
void useContext() override
bool respondToMostModules
bool log(const edm::ErrorObj &msg) override
messagelogger::ELseverityLevel traceThreshold
bool wantEpilogueSeparate
messagelogger::ELseverityLevel threshold
T first(std::pair< T, U > const &p)
void suppressContext() override
constexpr const ELseverityLevel ELdebug
void changeFile(std::ostream &os) override
void includeText() override
void suppressSubroutine() override