From a23c51bcb1b8d85b1ea06a7a16729fa4b87d8fd4 Mon Sep 17 00:00:00 2001 From: Andreas Stöckel Date: Fri, 5 Dec 2014 12:29:45 +0100 Subject: added logAt functions --- src/core/Logger.hpp | 88 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+) (limited to 'src') diff --git a/src/core/Logger.hpp b/src/core/Logger.hpp index a30374c..fd7bb08 100644 --- a/src/core/Logger.hpp +++ b/src/core/Logger.hpp @@ -240,6 +240,23 @@ public: log(severity, msg, currentFilename(), line, column); } + /** + * Logs the given message. The file name is set to the topmost file name on + * the file name stack. + * + * @param severity is the severity of the log message. + * @param msg is the actual log message. + * @param pos is a const reference to a variable which provides position + * information. + * @tparam PosType is the actual type of pos and must implement a getLine + * and getColumn function. + */ + template + void logAt(Severity severity, const std::string &msg, const PosType &pos) + { + log(severity, msg, pos.getLine(), pos.getColumn()); + } + /** * Logs the given loggable exception. * @@ -282,6 +299,21 @@ public: debug(msg, currentFilename(), line, column); } + /** + * Logs a debug message. The file name is set to the topmost file name on + * the file name stack. + * + * @param severity is the severity of the log message. + * @param msg is the actual log message. + * @param pos is a const reference to a variable which provides position + * information. + */ + template + void debugAt(const std::string &msg, const PosType &pos) + { + debug(msg, pos.getLine(), pos.getColumn()); + } + /** * Logs a note. The file name is set to the topmost file name on * the file name stack. @@ -313,6 +345,20 @@ public: note(msg, currentFilename(), line, column); } + /** + * Logs a note. The file name is set to the topmost file name on + * the file name stack. + * + * @param msg is the actual log message. + * @param pos is a const reference to a variable which provides position + * information. + */ + template + void noteAt(const std::string &msg, const PosType &pos) + { + note(msg, pos.getLine(), pos.getColumn()); + } + /** * Logs a warning. The file name is set to the topmost file name on * the file name stack. @@ -329,6 +375,20 @@ public: log(Severity::WARNING, msg, file, line, column); } + /** + * Logs a warning. The file name is set to the topmost file name on + * the file name stack. + * + * @param msg is the actual log message. + * @param pos is a const reference to a variable which provides position + * information. + */ + template + void warningAt(const std::string &msg, const PosType &pos) + { + warning(msg, pos.getLine(), pos.getColumn()); + } + /** * Logs a warning. The file name is set to the topmost file name on * the file name stack. @@ -375,6 +435,20 @@ public: error(msg, currentFilename(), line, column); } + /** + * Logs an error message. The file name is set to the topmost file name on + * the file name stack. + * + * @param msg is the actual log message. + * @param pos is a const reference to a variable which provides position + * information. + */ + template + void errorAt(const std::string &msg, const PosType &pos) + { + error(msg, pos.getLine(), pos.getColumn()); + } + /** * Logs a fatal error. The file name is set to the topmost file name on * the file name stack. @@ -406,6 +480,20 @@ public: fatalError(msg, currentFilename(), line, column); } + /** + * Logs a fatal error. The file name is set to the topmost file name on + * the file name stack. + * + * @param msg is the actual log message. + * @param pos is a const reference to a variable which provides position + * information. + */ + template + void fatalErrorAt(const std::string &msg, const PosType &pos) + { + fatalError(msg, pos.getLine(), pos.getColumn()); + } + /** * Pushes a new file name onto the internal filename stack. * -- cgit v1.2.3