diff options
author | Benjamin Paassen <bpaassen@techfak.uni-bielefeld.de> | 2014-12-12 11:30:46 +0100 |
---|---|---|
committer | Benjamin Paassen <bpaassen@techfak.uni-bielefeld.de> | 2014-12-12 11:30:46 +0100 |
commit | 3a86b9dbe2c98c32f08942b07354a0361e8bafdb (patch) | |
tree | 890c45e664534f8ce49a0f4cb9aeba68520f7543 /src/core/common | |
parent | 5fde58b21baa7d92194c7910a85ab542a61897a9 (diff) |
Slight changes to logging mechanism.
Diffstat (limited to 'src/core/common')
-rw-r--r-- | src/core/common/Logger.cpp | 14 | ||||
-rw-r--r-- | src/core/common/Logger.hpp | 12 |
2 files changed, 18 insertions, 8 deletions
diff --git a/src/core/common/Logger.cpp b/src/core/common/Logger.cpp index ab62b03..1811b68 100644 --- a/src/core/common/Logger.cpp +++ b/src/core/common/Logger.cpp @@ -118,6 +118,16 @@ public: return ss.str(); } + std::string bright() const + { + if (!active) { + return std::string{}; + } + std::stringstream ss; + ss << "\x1b[1m"; + return ss.str(); + } + std::string reset() const { if (!active) { @@ -152,7 +162,7 @@ void TerminalLogger::processMessage(Message msg) std::string filename = currentFilename(); bool hasFile = !filename.empty(); if (hasFile) { - os << t.color(Terminal::WHITE, true) << filename << t.reset(); + os << t.bright() << filename << t.reset(); } // Print line and column number @@ -160,7 +170,7 @@ void TerminalLogger::processMessage(Message msg) if (hasFile) { os << ':'; } - os << t.color(Terminal::WHITE, true) << msg.pos.line << t.reset(); + os << t.bright() << msg.pos.line << t.reset(); if (msg.pos.hasColumn()) { os << ':' << msg.pos.column; } diff --git a/src/core/common/Logger.hpp b/src/core/common/Logger.hpp index be82ea0..6604756 100644 --- a/src/core/common/Logger.hpp +++ b/src/core/common/Logger.hpp @@ -257,7 +257,7 @@ public: * context information. */ template <class PosType> - void logAt(Severity severity, std::string msg, PosType &pos) + void log(Severity severity, std::string msg, PosType &pos) { log(severity, std::move(msg), pos.getPosition(), pos.getContext()); } @@ -291,7 +291,7 @@ public: void debug(std::string msg, PosType &pos) { #ifndef NDEBUG - logAt(Severity::DEBUG, std::move(msg), pos); + log(Severity::DEBUG, std::move(msg), pos); #endif } @@ -319,7 +319,7 @@ public: template <class PosType> void note(std::string msg, PosType &pos) { - logAt(Severity::NOTE, std::move(msg), pos); + log(Severity::NOTE, std::move(msg), pos); } /** @@ -346,7 +346,7 @@ public: template <class PosType> void warning(std::string msg, PosType &pos) { - logAt(Severity::WARNING, std::move(msg), pos); + log(Severity::WARNING, std::move(msg), pos); } /** @@ -373,7 +373,7 @@ public: template <class PosType> void error(std::string msg, PosType &pos) { - logAt(Severity::ERROR, std::move(msg), pos); + log(Severity::ERROR, std::move(msg), pos); } /** @@ -401,7 +401,7 @@ public: template <class PosType> void fatalError(std::string msg, PosType &pos) { - logAt(Severity::FATAL_ERROR, std::move(msg), pos); + log(Severity::FATAL_ERROR, std::move(msg), pos); } /** |