aboutsummaryrefslogtreecommitdiff
path: root/src/example/log.cpp
diff options
context:
space:
mode:
authorLoek Le Blansch <loek@pipeframe.xyz>2024-10-21 11:17:23 +0200
committerLoek Le Blansch <loek@pipeframe.xyz>2024-10-21 11:17:23 +0200
commite58c98e224afcf4a28078344e0cd5f8c0e10961f (patch)
treed165add07884e842321a6b7af85ee47c1b07355e /src/example/log.cpp
parent157cdabe941be14ca72022e7a7c8c55a582a7c1c (diff)
add logging example + finish log color config integration
Diffstat (limited to 'src/example/log.cpp')
-rw-r--r--src/example/log.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/example/log.cpp b/src/example/log.cpp
new file mode 100644
index 0000000..2d693d1
--- /dev/null
+++ b/src/example/log.cpp
@@ -0,0 +1,25 @@
+/** \file
+ *
+ * Standalone example for usage of the logging functions
+ */
+
+#include <crepe/util/log.h>
+#include <crepe/api/Config.h>
+
+using namespace crepe;
+using namespace crepe::util;
+
+int main() {
+ auto & cfg = api::Config::get_instance();
+ // make sure all log messages get printed
+ cfg.log.level = util::log_level::TRACE;
+
+ dbg_trace();
+ dbg_logf("cfg.log.color is equal to %d", cfg.log.color);
+ logf(log_level::INFO, "info message!");
+ logf(log_level::WARNING, "very scary warning");
+ logf(log_level::ERROR, "fatal error!!!");
+
+ return 0;
+}
+