Fixed #4897 (callStackToString is not available when using custom message template)

This commit is contained in:
Alexander Mai 2013-07-08 06:44:25 +02:00 committed by Daniel Marjamäki
parent d177c8fd03
commit b7bb16ea77
3 changed files with 31 additions and 1 deletions

View File

@ -895,7 +895,8 @@ void CmdLineParser::PrintHelp()
" is in the same format as <spec> above.\n"
" --template='<text>' Format the error messages. E.g.\n"
" '{file}:{line},{severity},{id},{message}' or\n"
" '{file}({line}):({severity}) {message}'\n"
" '{file}({line}):({severity}) {message}' or\n"
" '{callstack} {message}'\n"
" Pre-defined templates: gcc, vs, edit.\n"
" -v, --verbose Output more detailed error information.\n"
" --version Print out version number.\n"

View File

@ -309,6 +309,7 @@ std::string ErrorLogger::ErrorMessage::toString(bool verbose, const std::string
findAndReplace(result, "{id}", _id);
findAndReplace(result, "{severity}", Severity::toString(_severity));
findAndReplace(result, "{message}", verbose ? _verboseMessage : _shortMessage);
findAndReplace(result, "{callstack}", _callStack.empty() ? "" : callStackToString(_callStack));
if (!_callStack.empty()) {
std::ostringstream oss;
oss << _callStack.back().line;

View File

@ -442,6 +442,34 @@ gui/test.cpp:16: error: Mismatching allocation and deallocation: k</programlisti
gui/test.cpp,31,error,memleak,Memory leak: b
gui/test.cpp,16,error,mismatchAllocDealloc,Mismatching allocation and deallocation: k</programlisting>
<para>The following format specifiers are supported:</para>
<variablelist>
<varlistentry>
<term>callstack</term>
<listitem>callstack - if available</listitem>
</varlistentry>
<varlistentry>
<term>file</term>
<listitem>filename</listitem>
</varlistentry>
<varlistentry>
<term>id</term>
<listitem>message id</listitem>
</varlistentry>
<varlistentry>
<term>line</term>
<listitem>line number</listitem>
</varlistentry>
<varlistentry>
<term>message</term>
<listitem>verbose message text</listitem>
</varlistentry>
<varlistentry>
<term>severity</term>
<listitem>severity</listitem>
</varlistentry>
</variablelist>
<para>The escape sequences \b (backspace), \n (newline), \r (formfeed) and
\t (horizontal tab) are supported.</para>
</chapter>