diff options
author | Andreas Stöckel <astoecke@techfak.uni-bielefeld.de> | 2014-12-11 21:46:11 +0100 |
---|---|---|
committer | Andreas Stöckel <astoecke@techfak.uni-bielefeld.de> | 2014-12-11 21:46:11 +0100 |
commit | 741463dd18efd8d126bcc70224025703858fdef7 (patch) | |
tree | 82f83172a3229f14957b6c3f90fd10180c6b2612 /src/core/common/Exceptions.cpp | |
parent | 3f62168ed0b088eec3cb2903f03966f7d501f564 (diff) |
refactored logger
Diffstat (limited to 'src/core/common/Exceptions.cpp')
-rw-r--r-- | src/core/common/Exceptions.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
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(); } } |