summaryrefslogtreecommitdiff
path: root/include/logger.hpp
diff options
context:
space:
mode:
authorAldrik Ramaekers <aldrikboy@gmail.com>2025-10-04 16:53:57 +0200
committerAldrik Ramaekers <aldrikboy@gmail.com>2025-10-04 16:53:57 +0200
commitf9f1955748a3b369f0a015405af131c9b6e3285c (patch)
treec74cec6b30daccee2d1841627b3913c51fd549e3 /include/logger.hpp
parent2855642dd16cea260f3b32351f0529328a0bcb15 (diff)
namespace for logger, strops, locales
Diffstat (limited to 'include/logger.hpp')
-rw-r--r--include/logger.hpp46
1 files changed, 46 insertions, 0 deletions
diff --git a/include/logger.hpp b/include/logger.hpp
new file mode 100644
index 0000000..b191ecb
--- /dev/null
+++ b/include/logger.hpp
@@ -0,0 +1,46 @@
+/*
+* Copyright (c) 2025 Aldrik Ramaekers <aldrik.ramaekers@gmail.com>
+*
+* Permission to use, copy, modify, and/or distribute this software for any
+* purpose with or without fee is hereby granted, provided that the above
+* copyright notice and this permission notice appear in all copies.
+*
+* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+*/
+
+#pragma once
+
+#include "timer.h"
+#include "imgui.h"
+#include "config.hpp"
+#include "administration.hpp"
+
+#define STOPWATCH_START tick_t timestamp_start = timer_current();
+#define STOPWATCH_TIME (timer_elapsed(timestamp_start)*1000.0f)
+
+namespace logger {
+
+ static const u32 MAX_LEN_LOG_HISTORY = 256;
+ static const u32 MAX_LEN_LOG_TXT = 128;
+
+ typedef struct {
+ u32 write_cursor;
+ u32 history_length;
+ char history[MAX_LEN_LOG_HISTORY][MAX_LEN_LOG_TXT];
+ ImVec4 colors[MAX_LEN_LOG_HISTORY];
+ } program_log;
+
+ program_log* get();
+
+ void clear();
+ void aerr(a_err errors);
+ void info(const char* fmt, ...) IM_FMTARGS(2);
+ void error(const char* fmt, ...) IM_FMTARGS(2);
+
+} \ No newline at end of file