From 63493b57363f592861f160a38164f2f7198a7812 Mon Sep 17 00:00:00 2001 From: vaxerski <43317083+vaxerski@users.noreply.github.com> Date: Mon, 22 Aug 2022 18:50:38 +0200 Subject: [PATCH] use a custom logging func for wlr --- src/debug/Log.cpp | 4 ++++ src/debug/Log.hpp | 2 ++ src/main.cpp | 2 +- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/debug/Log.cpp b/src/debug/Log.cpp index 367cf8ca..a341f4b4 100644 --- a/src/debug/Log.cpp +++ b/src/debug/Log.cpp @@ -12,6 +12,10 @@ void Debug::init(std::string IS) { logFile = "/tmp/hypr/" + IS + "/hyprland.log"; } +void Debug::wlrLog(wlr_log_importance level, const char* fmt, va_list args) { + Debug::log(NONE, std::string("[wlr] " + std::string(fmt)).c_str(), args); +} + void Debug::log(LogLevel level, const char* fmt, ...) { if (disableLogs && *disableLogs) diff --git a/src/debug/Log.hpp b/src/debug/Log.hpp index 4001d996..8f8f615c 100644 --- a/src/debug/Log.hpp +++ b/src/debug/Log.hpp @@ -1,5 +1,6 @@ #pragma once #include +#include #define LOGMESSAGESIZE 1024 @@ -15,6 +16,7 @@ enum LogLevel { namespace Debug { void init(std::string IS); void log(LogLevel level, const char* fmt, ...); + void wlrLog(wlr_log_importance level, const char* fmt, va_list args); inline std::string logFile; inline int64_t* disableLogs = nullptr; diff --git a/src/main.cpp b/src/main.cpp index 86c5da21..a37e993c 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -46,7 +46,7 @@ int main(int argc, char** argv) { const auto LOGWLR = getenv("HYPRLAND_LOG_WLR"); if (LOGWLR && std::string(LOGWLR) == "1") - wlr_log_init(WLR_DEBUG, nullptr); + wlr_log_init(WLR_DEBUG, Debug::wlrLog); // let's init the compositor. // it initializes basic Wayland stuff in the constructor.