diff options
author | Andreas Stöckel <astoecke@techfak.uni-bielefeld.de> | 2014-11-23 01:39:42 +0100 |
---|---|---|
committer | Andreas Stöckel <astoecke@techfak.uni-bielefeld.de> | 2014-11-23 01:39:42 +0100 |
commit | aaaf493e3cddcc2cb0797ca3fe7eca4f12a04453 (patch) | |
tree | a260341b3c9d0839358876a2d053fb20d0f3f05e /src/core/Exceptions.cpp | |
parent | ec0039e4656d579d423dac3f5d626cb2deed05af (diff) |
imlemented Logger, TerminalLogger, OusiaException, LoggableException
Diffstat (limited to 'src/core/Exceptions.cpp')
-rw-r--r-- | src/core/Exceptions.cpp | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/src/core/Exceptions.cpp b/src/core/Exceptions.cpp new file mode 100644 index 0000000..92d9293 --- /dev/null +++ b/src/core/Exceptions.cpp @@ -0,0 +1,45 @@ +/* + Ousía + Copyright (C) 2014, 2015 Benjamin Paaßen, Andreas Stöckel + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#include <sstream> + +#include "Exceptions.hpp" + +namespace ousia { + +/* Class LoggableException */ + +std::string LoggableException::formatMessage(const std::string &msg, + const std::string &file, int line, + int column, bool fatal) +{ + std::stringstream ss; + if (!file.empty()) { + ss << "while processing \"" << file << "\" "; + } + if (line >= 0) { + ss << "at line: " << line << " "; + if (column >= 0) { + ss << "col: " << column << " "; + } + } + ss << "message: " << msg; + return ss.str(); +} +} + |