aboutsummaryrefslogtreecommitdiff
path: root/src/crepe/util
diff options
context:
space:
mode:
authorLoek Le Blansch <loek@pipeframe.xyz>2024-11-26 20:03:41 +0100
committerLoek Le Blansch <loek@pipeframe.xyz>2024-11-26 20:03:41 +0100
commita685e5f743786cc6499e7ce8973bb78a83d101f7 (patch)
tree21d7aeb768912bef8f98436d13acb4423cffd8f0 /src/crepe/util
parent92e3fbda73128e65a31b3760b3fa4bd0147debe3 (diff)
big WIP
Diffstat (limited to 'src/crepe/util')
-rw-r--r--src/crepe/util/Log.cpp2
-rw-r--r--src/crepe/util/Log.h16
2 files changed, 17 insertions, 1 deletions
diff --git a/src/crepe/util/Log.cpp b/src/crepe/util/Log.cpp
index 84d80a8..bc86c7e 100644
--- a/src/crepe/util/Log.cpp
+++ b/src/crepe/util/Log.cpp
@@ -25,7 +25,7 @@ string Log::prefix(const Level & level) {
}
void Log::log(const Level & level, const string & msg) {
- auto & cfg = Config::get_instance();
+ auto & cfg = crepe::Config::get_instance();
if (level < cfg.log.level) return;
string out = Log::prefix(level) + msg;
diff --git a/src/crepe/util/Log.h b/src/crepe/util/Log.h
index fc0bb3a..914145a 100644
--- a/src/crepe/util/Log.h
+++ b/src/crepe/util/Log.h
@@ -77,6 +77,22 @@ private:
* \return Colored message severity prefix string
*/
static std::string prefix(const Level & level);
+
+public:
+ struct Config {
+ /**
+ * \brief Log level
+ *
+ * Only messages with equal or higher priority than this value will be logged.
+ */
+ Level level = INFO;
+ /**
+ * \brief Colored log output
+ *
+ * Enables log coloring using ANSI escape codes.
+ */
+ bool color = true;
+ };
};
} // namespace crepe