Skip to content

Commit 5a36b50

Browse files
committed
patternlayout.cxx: Fix formatting after previous merge.
1 parent d9db4d1 commit 5a36b50

File tree

1 file changed

+24
-20
lines changed

1 file changed

+24
-20
lines changed

src/patternlayout.cxx

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -580,26 +580,30 @@ void
580580
log4cplus::pattern::MDCPatternConverter::convert (tstring & result,
581581
const spi::InternalLoggingEvent& event)
582582
{
583-
if(!key.empty())
584-
{
585-
result = event.getMDC (key);
586-
}
587-
else
588-
{
589-
result = LOG4CPLUS_TEXT("");
590-
591-
MappedDiagnosticContextMap mdcMap = event.getMDCCopy();
592-
593-
for ( MappedDiagnosticContextMap::const_iterator it = mdcMap.begin(); it != mdcMap.end(); it ++)
594-
{
595-
tstring name(it->first);
596-
597-
tstring value(it->second);
598-
599-
result += LOG4CPLUS_TEXT("{") + name + LOG4CPLUS_TEXT(", ") + value + LOG4CPLUS_TEXT("}");
600-
601-
}
602-
}
583+
if (!key.empty())
584+
{
585+
result = event.getMDC (key);
586+
}
587+
else
588+
{
589+
result.clear ();
590+
591+
MappedDiagnosticContextMap const & mdcMap = event.getMDCCopy();
592+
593+
for (MappedDiagnosticContextMap::const_iterator it = mdcMap.begin();
594+
it != mdcMap.end(); ++it)
595+
{
596+
tstring const & name(it->first);
597+
tstring const & value(it->second);
598+
599+
result += LOG4CPLUS_TEXT("{");
600+
result += name;
601+
result += LOG4CPLUS_TEXT(", ");
602+
result += value;
603+
result += LOG4CPLUS_TEXT("}");
604+
605+
}
606+
}
603607
}
604608

605609

0 commit comments

Comments
 (0)