From e195e51c1bd4b17398ec6964f30751b6a54bbb44 Mon Sep 17 00:00:00 2001 From: Vaxry Date: Tue, 14 Nov 2023 20:06:04 +0000 Subject: logging: move to an internal rolling log buffer disables logging to the logfile by default --- src/debug/HyprCtl.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/debug/HyprCtl.cpp') diff --git a/src/debug/HyprCtl.cpp b/src/debug/HyprCtl.cpp index 217895b1..11f8d785 100644 --- a/src/debug/HyprCtl.cpp +++ b/src/debug/HyprCtl.cpp @@ -625,6 +625,20 @@ std::string animationsRequest(HyprCtl::eHyprCtlOutputFormat format) { return ret; } +std::string rollinglogRequest(HyprCtl::eHyprCtlOutputFormat format) { + std::string result = ""; + + if (format == HyprCtl::FORMAT_JSON) { + result += "[\n\"log\":\""; + result += escapeJSONStrings(Debug::rollingLog); + result += "\"]"; + } else { + result = Debug::rollingLog; + } + + return result; +} + std::string globalShortcutsRequest(HyprCtl::eHyprCtlOutputFormat format) { std::string ret = ""; const auto SHORTCUTS = g_pProtocolManager->m_pGlobalShortcutsProtocolManager->getAllShortcuts(); @@ -1351,6 +1365,8 @@ std::string getReply(std::string request) { return globalShortcutsRequest(format); else if (request == "animations") return animationsRequest(format); + else if (request == "rollinglog") + return rollinglogRequest(format); else if (request.starts_with("plugin")) return dispatchPlugin(request); else if (request.starts_with("notify")) -- cgit v1.2.3