aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorFuwn <[email protected]>2022-02-11 03:58:10 +0000
committerFuwn <[email protected]>2022-02-11 03:58:10 +0000
commitf4af7253eed6ee097435aebe5d4144bb4b322e66 (patch)
tree55083235e6ef4f222d4e48961506a44461124584 /include
parentfix(#1): detach instead of join, we don't care about NtQueryObject (diff)
downloadsoyuz-f4af7253eed6ee097435aebe5d4144bb4b322e66.tar.xz
soyuz-f4af7253eed6ee097435aebe5d4144bb4b322e66.zip
feat(library): implement colourful logging
Diffstat (limited to 'include')
-rw-r--r--include/soyuz/library.hh24
-rw-r--r--include/soyuz/tray.hh3
2 files changed, 20 insertions, 7 deletions
diff --git a/include/soyuz/library.hh b/include/soyuz/library.hh
index 8680cb3..f96bbf2 100644
--- a/include/soyuz/library.hh
+++ b/include/soyuz/library.hh
@@ -13,18 +13,13 @@
#include <string>
#include <Windows.h>
+#include <vector>
#define NT_SUCCESS(status) (status >= 0)
#define STATUS_INFO_LENGTH_MISMATCH ((NTSTATUS)0xC0000004L)
namespace soyuz {
-// enum log_level {
-// low, // blue
-// medium, // orange
-// high, // red
-// };
-
const std::string numbers_as_string[] = {
"zero",
"one",
@@ -33,6 +28,23 @@ const std::string numbers_as_string[] = {
"four",
};
+enum log_level {
+ trace,
+ debug,
+ info,
+ warn,
+ error,
+};
+
+struct log_t {
+ log_level level;
+ std::string value;
+
+ log_t(log_level level, std::string value) : level(level), value(std::move(value)) {}
+
+ auto to_coloref() -> COLORREF;
+};
+
static BOOL CALLBACK enum_windows_proc(HWND, LPARAM);
auto find_lunar() -> DWORD;
auto delete_handle(DWORD) -> int;
diff --git a/include/soyuz/tray.hh b/include/soyuz/tray.hh
index 54c998e..a6bdb89 100644
--- a/include/soyuz/tray.hh
+++ b/include/soyuz/tray.hh
@@ -15,7 +15,7 @@
#include <vector>
#include <Windows.h>
-#define LOG(message) logs.emplace_back(message);
+#include <soyuz/library.hh>
LRESULT CALLBACK WindowProcedure(HWND, UINT, WPARAM, LPARAM);
auto minimize() -> void;
@@ -25,6 +25,7 @@ auto InitNotifyIconData() -> void;
namespace soyuz {
auto log(const std::string &) -> void;
+auto log(log_level, const std::string &) -> void;
}