From 741463dd18efd8d126bcc70224025703858fdef7 Mon Sep 17 00:00:00 2001 From: Andreas Stöckel Date: Thu, 11 Dec 2014 21:46:11 +0100 Subject: refactored logger --- src/core/common/Exceptions.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'src/core/common/Exceptions.cpp') diff --git a/src/core/common/Exceptions.cpp b/src/core/common/Exceptions.cpp index d064f35..30c5626 100644 --- a/src/core/common/Exceptions.cpp +++ b/src/core/common/Exceptions.cpp @@ -25,21 +25,21 @@ namespace ousia { /* Class LoggableException */ std::string LoggableException::formatMessage(const std::string &msg, - const std::string &file, - int line, int column) + const TextCursor::Position &pos, + const TextCursor::Context &ctx) { std::stringstream ss; ss << "error "; - if (!file.empty()) { - ss << "while processing \"" << file << "\" "; - } - if (line >= 0) { - ss << "at line " << line << ", "; - if (column >= 0) { - ss << "column " << column << " "; + if (pos.hasLine()) { + ss << "at line " << pos.line << ", "; + if (pos.hasColumn()) { + ss << "column " << pos.column << " "; } } ss << "with message: " << msg; + if (ctx.valid()) { + ss << " in context \"" << ctx.text << "\""; + } return ss.str(); } } -- cgit v1.2.3