diff --git a/cli/cmdlineparser.cpp b/cli/cmdlineparser.cpp index ee1dffefe..802eb68bf 100644 --- a/cli/cmdlineparser.cpp +++ b/cli/cmdlineparser.cpp @@ -895,7 +895,8 @@ void CmdLineParser::PrintHelp() " is in the same format as above.\n" " --template='' 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" diff --git a/lib/errorlogger.cpp b/lib/errorlogger.cpp index 00c7e6d1d..5cf9aaf6f 100644 --- a/lib/errorlogger.cpp +++ b/lib/errorlogger.cpp @@ -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; diff --git a/man/manual.docbook b/man/manual.docbook index aea0c2132..a14ad4c00 100644 --- a/man/manual.docbook +++ b/man/manual.docbook @@ -442,6 +442,34 @@ gui/test.cpp:16: error: Mismatching allocation and deallocation: k + The following format specifiers are supported: + + + callstack + callstack - if available + + + file + filename + + + id + message id + + + line + line number + + + message + verbose message text + + + severity + severity + + + The escape sequences \b (backspace), \n (newline), \r (formfeed) and \t (horizontal tab) are supported.