diff options
| author | Vaxry <43317083+vaxerski@users.noreply.github.com> | 2025-12-18 17:23:24 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-12-18 17:23:24 +0000 |
| commit | 6175ecd4c4ba817c4620f66a75e1e11da7c7a8ca (patch) | |
| tree | cf73852f1fc08b1dcee5a3a7380f914aaad9c50a /src/managers | |
| parent | f88deb928a0f7dc02f427473f8c29e8f2bed14a3 (diff) | |
debug: move to hyprutils' logger (#12673)
Diffstat (limited to 'src/managers')
27 files changed, 294 insertions, 292 deletions
diff --git a/src/managers/ANRManager.cpp b/src/managers/ANRManager.cpp index db7a245f..a9cff74f 100644 --- a/src/managers/ANRManager.cpp +++ b/src/managers/ANRManager.cpp @@ -1,7 +1,7 @@ #include "ANRManager.hpp" #include "../helpers/fs/FsUtils.hpp" -#include "../debug/Log.hpp" +#include "../debug/log/Logger.hpp" #include "../macros.hpp" #include "HookSystemManager.hpp" #include "../Compositor.hpp" @@ -17,7 +17,7 @@ static constexpr auto TIMER_TIMEOUT = std::chrono::milliseconds(1500); CANRManager::CANRManager() { if (!NFsUtils::executableExistsInPath("hyprland-dialog")) { - Debug::log(ERR, "hyprland-dialog missing from PATH, cannot start ANRManager"); + Log::logger->log(Log::ERR, "hyprland-dialog missing from PATH, cannot start ANRManager"); return; } @@ -206,7 +206,7 @@ void CANRManager::SANRData::runDialog(const std::string& appName, const std::str dialogBox->open()->then([dialogWmPID, this, OPTION_TERMINATE_STR, OPTION_WAIT_STR](SP<CPromiseResult<std::string>> r) { if (r->hasError()) { - Debug::log(ERR, "CANRManager::SANRData::runDialog: error spawning dialog"); + Log::logger->log(Log::ERR, "CANRManager::SANRData::runDialog: error spawning dialog"); return; } @@ -217,7 +217,7 @@ void CANRManager::SANRData::runDialog(const std::string& appName, const std::str else if (result.starts_with(OPTION_WAIT_STR)) dialogSaidWait = true; else - Debug::log(ERR, "CANRManager::SANRData::runDialog: lambda: unrecognized result: {}", result); + Log::logger->log(Log::ERR, "CANRManager::SANRData::runDialog: lambda: unrecognized result: {}", result); }); } diff --git a/src/managers/CursorManager.cpp b/src/managers/CursorManager.cpp index d3c26339..8392db0a 100644 --- a/src/managers/CursorManager.cpp +++ b/src/managers/CursorManager.cpp @@ -16,7 +16,7 @@ static void hcLogger(enum eHyprcursorLogLevel level, char* message) { if (level == HC_LOG_TRACE) return; - Debug::log(NONE, "[hc] {}", message); + Log::logger->log(Log::DEBUG, "[hc] {}", message); } CCursorBuffer::CCursorBuffer(cairo_surface_t* surf, const Vector2D& size_, const Vector2D& hot_) : m_hotspot(hot_), m_stride(cairo_image_surface_get_stride(surf)) { @@ -83,11 +83,11 @@ CCursorManager::CCursorManager() { } if (m_size <= 0) { - Debug::log(WARN, "HYPRCURSOR_SIZE size not set, defaulting to size 24"); + Log::logger->log(Log::WARN, "HYPRCURSOR_SIZE size not set, defaulting to size 24"); m_size = 24; } } else { - Debug::log(ERR, "Hyprcursor failed loading theme \"{}\", falling back to Xcursor.", m_theme); + Log::logger->log(Log::ERR, "Hyprcursor failed loading theme \"{}\", falling back to Xcursor.", m_theme); auto const* SIZE = getenv("XCURSOR_SIZE"); if (SIZE) { @@ -97,7 +97,7 @@ CCursorManager::CCursorManager() { } if (m_size <= 0) { - Debug::log(WARN, "XCURSOR_SIZE size not set, defaulting to size 24"); + Log::logger->log(Log::WARN, "XCURSOR_SIZE size not set, defaulting to size 24"); m_size = 24; } } @@ -203,7 +203,7 @@ void CCursorManager::setCursorFromName(const std::string& name) { } if (m_currentCursorShapeData.images.empty()) { - Debug::log(ERR, "BUG THIS: No fallback found for a cursor in setCursorFromName"); + Log::logger->log(Log::ERR, "BUG THIS: No fallback found for a cursor in setCursorFromName"); return false; } } @@ -328,7 +328,7 @@ bool CCursorManager::changeTheme(const std::string& name, const int size) { m_hyprcursor = makeUnique<Hyprcursor::CHyprcursorManager>(m_theme.empty() ? nullptr : m_theme.c_str(), options); if (!m_hyprcursor->valid()) { - Debug::log(ERR, "Hyprcursor failed loading theme \"{}\", falling back to XCursor.", m_theme); + Log::logger->log(Log::ERR, "Hyprcursor failed loading theme \"{}\", falling back to XCursor.", m_theme); m_xcursor->loadTheme(m_theme.empty() ? xcursor_theme : m_theme, m_size, m_cursorScale); } } else diff --git a/src/managers/DonationNagManager.cpp b/src/managers/DonationNagManager.cpp index 826439b2..62dd15b7 100644 --- a/src/managers/DonationNagManager.cpp +++ b/src/managers/DonationNagManager.cpp @@ -1,5 +1,5 @@ #include "DonationNagManager.hpp" -#include "../debug/Log.hpp" +#include "../debug/log/Logger.hpp" #include "VersionKeeperManager.hpp" #include "eventLoop/EventLoopManager.hpp" #include "../config/ConfigValue.hpp" @@ -69,12 +69,12 @@ CDonationNagManager::CDonationNagManager() { // don't nag if the last nag was less than a month ago. This is // mostly for first-time nags, as other nags happen in specific time frames shorter than a month if (EPOCH - state.epoch < MONTH_IN_SECONDS) { - Debug::log(LOG, "DonationNag: last nag was {} days ago, too early for a nag.", sc<int>(std::round((EPOCH - state.epoch) / sc<double>(DAY_IN_SECONDS)))); + Log::logger->log(Log::DEBUG, "DonationNag: last nag was {} days ago, too early for a nag.", sc<int>(std::round((EPOCH - state.epoch) / sc<double>(DAY_IN_SECONDS)))); return; } if (!NFsUtils::executableExistsInPath("hyprland-donate-screen")) { - Debug::log(ERR, "DonationNag: executable doesn't exist, skipping."); + Log::logger->log(Log::ERR, "DonationNag: executable doesn't exist, skipping."); return; } @@ -91,7 +91,7 @@ CDonationNagManager::CDonationNagManager() { if (DAY < nagPoint.dayStart || DAY > nagPoint.dayEnd) continue; - Debug::log(LOG, "DonationNag: hit nag month {} days {}-{}, it's {} today, nagging", MONTH, nagPoint.dayStart, nagPoint.dayEnd, DAY); + Log::logger->log(Log::DEBUG, "DonationNag: hit nag month {} days {}-{}, it's {} today, nagging", MONTH, nagPoint.dayStart, nagPoint.dayEnd, DAY); fire(); @@ -103,10 +103,10 @@ CDonationNagManager::CDonationNagManager() { } if (!m_fired) - Debug::log(LOG, "DonationNag: didn't hit any nagging periods, checking update"); + Log::logger->log(Log::DEBUG, "DonationNag: didn't hit any nagging periods, checking update"); if (state.major < currentMajor) { - Debug::log(LOG, "DonationNag: hit nag for major update {} -> {}", state.major, currentMajor); + Log::logger->log(Log::DEBUG, "DonationNag: hit nag for major update {} -> {}", state.major, currentMajor); fire(); @@ -116,7 +116,7 @@ CDonationNagManager::CDonationNagManager() { } if (!m_fired) - Debug::log(LOG, "DonationNag: didn't hit nagging conditions"); + Log::logger->log(Log::DEBUG, "DonationNag: didn't hit nagging conditions"); } bool CDonationNagManager::fired() { diff --git a/src/managers/EventManager.cpp b/src/managers/EventManager.cpp index c4c6c5d7..6d42a818 100644 --- a/src/managers/EventManager.cpp +++ b/src/managers/EventManager.cpp @@ -13,27 +13,27 @@ using namespace Hyprutils::OS; CEventManager::CEventManager() : m_socketFD(socket(AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC | SOCK_NONBLOCK, 0)) { if (!m_socketFD.isValid()) { - Debug::log(ERR, "Couldn't start the Hyprland Socket 2. (1) IPC will not work."); + Log::logger->log(Log::ERR, "Couldn't start the Hyprland Socket 2. (1) IPC will not work."); return; } sockaddr_un SERVERADDRESS = {.sun_family = AF_UNIX}; const auto PATH = g_pCompositor->m_instancePath + "/.socket2.sock"; if (PATH.length() > sizeof(SERVERADDRESS.sun_path) - 1) { - Debug::log(ERR, "Socket2 path is too long. (2) IPC will not work."); + Log::logger->log(Log::ERR, "Socket2 path is too long. (2) IPC will not work."); return; } strncpy(SERVERADDRESS.sun_path, PATH.c_str(), sizeof(SERVERADDRESS.sun_path) - 1); if (bind(m_socketFD.get(), rc<sockaddr*>(&SERVERADDRESS), SUN_LEN(&SERVERADDRESS)) < 0) { - Debug::log(ERR, "Couldn't bind the Hyprland Socket 2. (3) IPC will not work."); + Log::logger->log(Log::ERR, "Couldn't bind the Hyprland Socket 2. (3) IPC will not work."); return; } // 10 max queued. if (listen(m_socketFD.get(), 10) < 0) { - Debug::log(ERR, "Couldn't listen on the Hyprland Socket 2. (4) IPC will not work."); + Log::logger->log(Log::ERR, "Couldn't listen on the Hyprland Socket 2. (4) IPC will not work."); return; } @@ -59,7 +59,7 @@ int CEventManager::onClientEvent(int fd, uint32_t mask, void* data) { int CEventManager::onServerEvent(int fd, uint32_t mask) { if (mask & WL_EVENT_ERROR || mask & WL_EVENT_HANGUP) { - Debug::log(ERR, "Socket2 hangup?? IPC broke"); + Log::logger->log(Log::ERR, "Socket2 hangup?? IPC broke"); wl_event_source_remove(m_eventSource); m_eventSource = nullptr; @@ -73,7 +73,7 @@ int CEventManager::onServerEvent(int fd, uint32_t mask) { CFileDescriptor ACCEPTEDCONNECTION{accept4(m_socketFD.get(), rc<sockaddr*>(&clientAddress), &clientSize, SOCK_CLOEXEC | SOCK_NONBLOCK)}; if (!ACCEPTEDCONNECTION.isValid()) { if (errno != EAGAIN) { - Debug::log(ERR, "Socket2 failed receiving connection, errno: {}", errno); + Log::logger->log(Log::ERR, "Socket2 failed receiving connection, errno: {}", errno); wl_event_source_remove(m_eventSource); m_eventSource = nullptr; m_socketFD.reset(); @@ -82,7 +82,7 @@ int CEventManager::onServerEvent(int fd, uint32_t mask) { return 0; } - Debug::log(LOG, "Socket2 accepted a new client at FD {}", ACCEPTEDCONNECTION.get()); + Log::logger->log(Log::DEBUG, "Socket2 accepted a new client at FD {}", ACCEPTEDCONNECTION.get()); // add to event loop so we can close it when we need to auto* eventSource = wl_event_loop_add_fd(g_pCompositor->m_wlEventLoop, ACCEPTEDCONNECTION.get(), 0, onServerEvent, nullptr); @@ -97,7 +97,7 @@ int CEventManager::onServerEvent(int fd, uint32_t mask) { int CEventManager::onClientEvent(int fd, uint32_t mask) { if (mask & WL_EVENT_ERROR || mask & WL_EVENT_HANGUP) { - Debug::log(LOG, "Socket2 fd {} hung up", fd); + Log::logger->log(Log::DEBUG, "Socket2 fd {} hung up", fd); removeClientByFD(fd); return 0; } @@ -142,7 +142,7 @@ std::string CEventManager::formatEvent(const SHyprIPCEvent& event) const { void CEventManager::postEvent(const SHyprIPCEvent& event) { if (g_pCompositor->m_isShuttingDown) { - Debug::log(WARN, "Suppressed (shutting down) event of type {}, content: {}", event.event, event.data); + Log::logger->log(Log::WARN, "Suppressed (shutting down) event of type {}, content: {}", event.event, event.data); return; } @@ -154,7 +154,7 @@ void CEventManager::postEvent(const SHyprIPCEvent& event) { if (QUEUESIZE > 0 || write(it->fd.get(), sharedEvent->c_str(), sharedEvent->length()) < 0) { if (QUEUESIZE >= MAX_QUEUED_EVENTS) { // too many events queued, remove the client - Debug::log(ERR, "Socket2 fd {} overflowed event queue, removing", it->fd.get()); + Log::logger->log(Log::ERR, "Socket2 fd {} overflowed event queue, removing", it->fd.get()); it = removeClientByFD(it->fd.get()); continue; } diff --git a/src/managers/HookSystemManager.cpp b/src/managers/HookSystemManager.cpp index a5623f08..0aa2d93e 100644 --- a/src/managers/HookSystemManager.cpp +++ b/src/managers/HookSystemManager.cpp @@ -62,7 +62,7 @@ void CHookSystemManager::emit(std::vector<SCallbackFNPtr>* const callbacks, SCal } catch (std::exception& e) { // TODO: this works only once...? faultyHandles.push_back(cb.handle); - Debug::log(ERR, "[hookSystem] Hook from plugin {:x} caused a SIGSEGV, queueing for unloading.", rc<uintptr_t>(cb.handle)); + Log::logger->log(Log::ERR, "[hookSystem] Hook from plugin {:x} caused a SIGSEGV, queueing for unloading.", rc<uintptr_t>(cb.handle)); } } @@ -77,7 +77,7 @@ void CHookSystemManager::emit(std::vector<SCallbackFNPtr>* const callbacks, SCal std::vector<SCallbackFNPtr>* CHookSystemManager::getVecForEvent(const std::string& event) { if (!m_registeredHooks.contains(event)) - Debug::log(LOG, "[hookSystem] New hook event registered: {}", event); + Log::logger->log(Log::DEBUG, "[hookSystem] New hook event registered: {}", event); return &m_registeredHooks[event]; } diff --git a/src/managers/KeybindManager.cpp b/src/managers/KeybindManager.cpp index b33ca3c1..101374ad 100644 --- a/src/managers/KeybindManager.cpp +++ b/src/managers/KeybindManager.cpp @@ -13,7 +13,7 @@ #include "Compositor.hpp" #include "TokenManager.hpp" #include "eventLoop/EventLoopManager.hpp" -#include "debug/Log.hpp" +#include "debug/log/Logger.hpp" #include "../managers/HookSystemManager.hpp" #include "../managers/input/InputManager.hpp" #include "../managers/animation/DesktopAnimationManager.hpp" @@ -163,7 +163,7 @@ CKeybindManager::CKeybindManager() { const auto DISPATCHER = g_pKeybindManager->m_dispatchers.find(m_lastLongPressKeybind->handler); - Debug::log(LOG, "Long press timeout passed, calling dispatcher."); + Log::logger->log(Log::DEBUG, "Long press timeout passed, calling dispatcher."); DISPATCHER->second(m_lastLongPressKeybind->arg); }, nullptr); @@ -181,7 +181,7 @@ CKeybindManager::CKeybindManager() { for (const auto& k : m_activeKeybinds) { const auto DISPATCHER = g_pKeybindManager->m_dispatchers.find(k->handler); - Debug::log(LOG, "Keybind repeat triggered, calling dispatcher."); + Log::logger->log(Log::DEBUG, "Keybind repeat triggered, calling dispatcher."); DISPATCHER->second(k->arg); } @@ -307,8 +307,8 @@ void CKeybindManager::updateXKBTranslationState() { ", layout: " + LAYOUT + " )", CHyprColor(1.0, 50.0 / 255.0, 50.0 / 255.0, 1.0)); - Debug::log(ERR, "[XKBTranslationState] Keyboard layout {} with variant {} (rules: {}, model: {}, options: {}) couldn't have been loaded.", rules.layout, rules.variant, - rules.rules, rules.model, rules.options); + Log::logger->log(Log::ERR, "[XKBTranslationState] Keyboard layout {} with variant {} (rules: {}, model: {}, options: {}) couldn't have been loaded.", rules.layout, + rules.variant, rules.rules, rules.model, rules.options); memset(&rules, 0, sizeof(rules)); PKEYMAP = xkb_keymap_new_from_names2(PCONTEXT, &rules, XKB_KEYMAP_FORMAT_TEXT_V2, XKB_KEYMAP_COMPILE_NO_FLAGS); @@ -349,7 +349,7 @@ bool CKeybindManager::tryMoveFocusToMonitor(PHLMONITOR monitor) { if (!LASTMONITOR) return false; if (LASTMONITOR == monitor) { - Debug::log(LOG, "Tried to move to active monitor"); + Log::logger->log(Log::DEBUG, "Tried to move to active monitor"); return false; } @@ -429,7 +429,7 @@ bool CKeybindManager::onKeyEvent(std::any event, SP<IKeyboard> pKeyboard) { return true; if (!m_xkbTranslationState) { - Debug::log(ERR, "BUG THIS: m_pXKBTranslationState nullptr!"); + Log::logger->log(Log::ERR, "BUG THIS: m_pXKBTranslationState nullptr!"); updateXKBTranslationState(); if (!m_xkbTranslationState) @@ -497,7 +497,7 @@ bool CKeybindManager::onKeyEvent(std::any event, SP<IKeyboard> pKeyboard) { } } if (!foundInPressedKeys) { - Debug::log(ERR, "BUG THIS: key not found in m_dPressedKeys"); + Log::logger->log(Log::ERR, "BUG THIS: key not found in m_dPressedKeys"); // fallback with wrong `KEY.modmaskAtPressTime`, this can be buggy suppressEvent = !handleKeybinds(MODS, KEY, false, pKeyboard).passEvent; } @@ -582,7 +582,7 @@ bool CKeybindManager::onMouseEvent(const IPointer::SButtonEvent& e) { } } if (!foundInPressedKeys) { - Debug::log(ERR, "BUG THIS: key not found in m_dPressedKeys (2)"); + Log::logger->log(Log::ERR, "BUG THIS: key not found in m_dPressedKeys (2)"); // fallback with wrong `KEY.modmaskAtPressTime`, this can be buggy suppressEvent = !handleKeybinds(MODS, KEY, false, nullptr).passEvent; } @@ -768,10 +768,10 @@ SDispatchResult CKeybindManager::handleKeybinds(const uint32_t modmask, const SP // Should never happen, as we check in the ConfigManager, but oh well if (DISPATCHER == m_dispatchers.end()) { - Debug::log(ERR, "Invalid handler in a keybind! (handler {} does not exist)", k->handler); + Log::logger->log(Log::ERR, "Invalid handler in a keybind! (handler {} does not exist)", k->handler); } else { // call the dispatcher - Debug::log(LOG, "Keybind triggered, calling dispatcher ({}, {}, {}, {})", modmask, key.keyName, key.keysym, DISPATCHER->first); + Log::logger->log(Log::DEBUG, "Keybind triggered, calling dispatcher ({}, {}, {}, {})", modmask, key.keyName, key.keysym, DISPATCHER->first); m_passPressed = sc<int>(pressed); @@ -809,7 +809,7 @@ SDispatchResult CKeybindManager::handleKeybinds(const uint32_t modmask, const SP res.passEvent |= !found; if (!found && !*PDISABLEINHIBIT && PROTO::shortcutsInhibit->isInhibited()) { - Debug::log(LOG, "Keybind handling is disabled due to an inhibitor"); + Log::logger->log(Log::DEBUG, "Keybind handling is disabled due to an inhibitor"); res.success = false; if (res.error.empty()) @@ -876,7 +876,7 @@ bool CKeybindManager::handleVT(xkb_keysym_t keysym) { if (!CURRENT_TTY.has_value() || *CURRENT_TTY == TTY) return true; - Debug::log(LOG, "Switching from VT {} to VT {}", *CURRENT_TTY, TTY); + Log::logger->log(Log::DEBUG, "Switching from VT {} to VT {}", *CURRENT_TTY, TTY); g_pCompositor->m_aqBackend->session->switchVT(TTY); } @@ -928,7 +928,7 @@ uint64_t CKeybindManager::spawnWithRules(std::string args, PHLWORKSPACE pInitial Desktop::Rule::ruleEngine()->registerRule(std::move(rule)); - Debug::log(LOG, "Applied rule arguments for exec."); + Log::logger->log(Log::DEBUG, "Applied rule arguments for exec."); } const uint64_t PROC = spawnRawProc(args, pInitialWorkspace, execToken); @@ -942,13 +942,13 @@ SDispatchResult CKeybindManager::spawnRaw(std::string args) { } uint64_t CKeybindManager::spawnRawProc(std::string args, PHLWORKSPACE pInitialWorkspace, const std::string& execRuleToken) { - Debug::log(LOG, "Executing {}", args); + Log::logger->log(Log::DEBUG, "Executing {}", args); const auto HLENV = getHyprlandLaunchEnv(pInitialWorkspace); pid_t child = fork(); if (child < 0) { - Debug::log(LOG, "Fail to fork"); + Log::logger->log(Log::DEBUG, "Fail to fork"); return 0; } if (child == 0) { @@ -980,7 +980,7 @@ uint64_t CKeybindManager::spawnRawProc(std::string args, PHLWORKSPACE pInitialWo } // run in parent - Debug::log(LOG, "Process Created with pid {}", child); + Log::logger->log(Log::DEBUG, "Process Created with pid {}", child); return child; } @@ -989,7 +989,7 @@ SDispatchResult CKeybindManager::killActive(std::string args) { const auto PWINDOW = Desktop::focusState()->window(); if (!PWINDOW) { - Debug::log(ERR, "killActive: no window found"); + Log::logger->log(Log::ERR, "killActive: no window found"); return {.success = false, .error = "killActive: no window found"}; } @@ -1011,7 +1011,7 @@ SDispatchResult CKeybindManager::closeWindow(std::string args) { const auto PWINDOW = g_pCompositor->getWindowByRegex(args); if (!PWINDOW) { - Debug::log(ERR, "closeWindow: no window found"); + Log::logger->log(Log::ERR, "closeWindow: no window found"); return {.success = false, .error = "closeWindow: no window found"}; } @@ -1027,7 +1027,7 @@ SDispatchResult CKeybindManager::killWindow(std::string args) { const auto PWINDOW = g_pCompositor->getWindowByRegex(args); if (!PWINDOW) { - Debug::log(ERR, "killWindow: no window found"); + Log::logger->log(Log::ERR, "killWindow: no window found"); return {.success = false, .error = "killWindow: no window found"}; } @@ -1043,12 +1043,12 @@ SDispatchResult CKeybindManager::signalActive(std::string args) { try { const auto SIGNALNUM = std::stoi(args); if (SIGNALNUM < 1 || SIGNALNUM > 31) { - Debug::log(ERR, "signalActive: invalid signal number {}", SIGNALNUM); + Log::logger->log(Log::ERR, "signalActive: invalid signal number {}", SIGNALNUM); return {.success = false, .error = std::format("signalActive: invalid signal number {}", SIGNALNUM)}; } kill(Desktop::focusState()->window()->getPID(), SIGNALNUM); } catch (const std::exception& e) { - Debug::log(ERR, "signalActive: invalid signal format \"{}\"", args); + Log::logger->log(Log::ERR, "signalActive: invalid signal format \"{}\"", args); return {.success = false, .error = std::format("signalActive: invalid signal format \"{}\"", args)}; } @@ -1064,7 +1064,7 @@ SDispatchResult CKeybindManager::signalWindow(std::string args) { const auto PWINDOW = g_pCompositor->getWindowByRegex(WINDOWREGEX); if (!PWINDOW) { - Debug::log(ERR, "signalWindow: no window"); + Log::logger->log(Log::ERR, "signalWindow: no window"); return {.success = false, .error = "signalWindow: no window"}; } @@ -1074,12 +1074,12 @@ SDispatchResult CKeybindManager::signalWindow(std::string args) { try { const auto SIGNALNUM = std::stoi(SIGNAL); if (SIGNALNUM < 1 || SIGNALNUM > 31) { - Debug::log(ERR, "signalWindow: invalid signal number {}", SIGNALNUM); + Log::logger->log(Log::ERR, "signalWindow: invalid signal number {}", SIGNALNUM); return {.success = false, .error = std::format("signalWindow: invalid signal number {}", SIGNALNUM)}; } kill(PWINDOW->getPID(), SIGNALNUM); } catch (const std::exception& e) { - Debug::log(ERR, "signalWindow: invalid signal format \"{}\"", SIGNAL); + Log::logger->log(Log::ERR, "signalWindow: invalid signal format \"{}\"", SIGNAL); return {.success = false, .error = std::format("signalWindow: invalid signal format \"{}\"", SIGNAL)}; } @@ -1190,7 +1190,7 @@ static SWorkspaceIDName getWorkspaceToChangeFromArgs(std::string args, PHLWORKSP const SWorkspaceIDName PPREVWS = PER_MON ? PMONITOR->getPrevWorkspaceIDName(PCURRENTWORKSPACE->m_id) : PCURRENTWORKSPACE->getPrevWorkspaceIDName(); // Do nothing if there's no previous workspace, otherwise switch to it. if (PPREVWS.id == -1 || PPREVWS.id == PCURRENTWORKSPACE->m_id) { - Debug::log(LOG, "No previous workspace to change to"); + Log::logger->log(Log::DEBUG, "No previous workspace to change to"); return {.id = WORKSPACE_NOT_CHANGED}; } @@ -1219,7 +1219,7 @@ SDispatchResult CKeybindManager::changeworkspace(std::string args) { const auto& [workspaceToChangeTo, workspaceName, isAutoID] = getWorkspaceToChangeFromArgs(args, PCURRENTWORKSPACE, PMONITOR); if (workspaceToChangeTo == WORKSPACE_INVALID) { - Debug::log(ERR, "Error in changeworkspace, invalid value"); + Log::logger->log(Log::ERR, "Error in changeworkspace, invalid value"); return {.success = false, .error = "Error in changeworkspace, invalid value"}; } @@ -1383,12 +1383,12 @@ SDispatchResult CKeybindManager::moveActiveToWorkspace(std::string args) { const auto& [WORKSPACEID, workspaceName, isAutoID] = getWorkspaceIDNameFromString(args); if (WORKSPACEID == WORKSPACE_INVALID) { - Debug::log(LOG, "Invalid workspace in moveActiveToWorkspace"); + Log::logger->log(Log::DEBUG, "Invalid workspace in moveActiveToWorkspace"); return {.success = false, .error = "Invalid workspace in moveActiveToWorkspace"}; } if (WORKSPACEID == PWINDOW->workspaceID()) { - Debug::log(LOG, "Not moving to workspace because it didn't change."); + Log::logger->log(Log::DEBUG, "Not moving to workspace because it didn't change."); return {.success = false, .error = "Not moving to workspace because it didn't change."}; } @@ -1444,7 +1444,7 @@ SDispatchResult CKeybindManager::moveActiveToWorkspaceSilent(std::string args) { const auto& [WORKSPACEID, workspaceName, isAutoID] = getWorkspaceIDNameFromString(args); if (WORKSPACEID == WORKSPACE_INVALID) { - Debug::log(ERR, "Error in moveActiveToWorkspaceSilent, invalid value"); + Log::logger->log(Log::ERR, "Error in moveActiveToWorkspaceSilent, invalid value"); return {.success = false, .error = "Error in moveActiveToWorkspaceSilent, invalid value"}; } @@ -1482,7 +1482,7 @@ SDispatchResult CKeybindManager::moveFocusTo(std::string args) { char arg = args[0]; if (!isDirection(args)) { - Debug::log(ERR, "Cannot move focus in direction {}, unsupported direction. Supported: l,r,u/t,d/b", arg); + Log::logger->log(Log::ERR, "Cannot move focus in direction {}, unsupported direction. Supported: l,r,u/t,d/b", arg); return {.success = false, .error = std::format("Cannot move focus in direction {}, unsupported direction. Supported: l,r,u/t,d/b", arg)}; } @@ -1518,7 +1518,7 @@ SDispatchResult CKeybindManager::moveFocusTo(std::string args) { return {}; } - Debug::log(LOG, "No window found in direction {}, looking for a monitor", arg); + Log::logger->log(Log::DEBUG, "No window found in direction {}, looking for a monitor", arg); if (*PMONITORFALLBACK && tryMoveFocusToMonitor(g_pCompositor->getMonitorInDirection(arg))) return {}; @@ -1527,7 +1527,7 @@ SDispatchResult CKeybindManager::moveFocusTo(std::string args) { if (*PNOFALLBACK) return {.success = false, .error = std::format("Nothing to focus to in direction {}", arg)}; - Debug::log(LOG, "No monitor found in direction {}, getting the inverse edge", arg); + Log::logger->log(Log::DEBUG, "No monitor found in direction {}, getting the inverse edge", arg); const auto PMONITOR = PLASTWINDOW->m_monitor.lock(); @@ -1612,11 +1612,11 @@ SDispatchResult CKeybindManager::swapActive(std::string args) { PWINDOWTOCHANGETO = g_pCompositor->getWindowByRegex(args); if (!PWINDOWTOCHANGETO || PWINDOWTOCHANGETO == PLASTWINDOW) { - Debug::log(ERR, "Can't swap with {}, invalid window", args); + Log::logger->log(Log::ERR, "Can't swap with {}, invalid window", args); return {.success = false, .error = std::format("Can't swap with {}, invalid window", args)}; } - Debug::log(LOG, "Swapping active window with {}", args); + Log::logger->log(Log::DEBUG, "Swapping active window with {}", args); updateRelativeCursorCoords(); g_pLayoutManager->getCurrentLayout()->switchWindows(PLASTWINDOW, PWINDOWTOCHANGETO); @@ -1644,7 +1644,7 @@ SDispatchResult CKeybindManager::moveActiveTo(std::string args) { } if (!isDirection(args)) { - Debug::log(ERR, "Cannot move window in direction {}, unsupported direction. Supported: l,r,u/t,d/b", arg); + Log::logger->log(Log::ERR, "Cannot move window in direction {}, unsupported direction. Supported: l,r,u/t,d/b", arg); return {.success = false, .error = std::format("Cannot move window in direction {}, unsupported direction. Supported: l,r,u/t,d/b", arg)}; } @@ -1807,7 +1807,7 @@ SDispatchResult CKeybindManager::alterSplitRatio(std::string args) { splitResult = getPlusMinusKeywordResult(args, 0); if (!splitResult.has_value()) { - Debug::log(ERR, "Splitratio invalid in alterSplitRatio!"); + Log::logger->log(Log::ERR, "Splitratio invalid in alterSplitRatio!"); return {.success = false, .error = "Splitratio invalid in alterSplitRatio!"}; } @@ -1830,14 +1830,14 @@ SDispatchResult CKeybindManager::focusMonitor(std::string arg) { SDispatchResult CKeybindManager::moveCursorToCorner(std::string arg) { if (!isNumber(arg)) { - Debug::log(ERR, "moveCursorToCorner, arg has to be a number."); + Log::logger->log(Log::ERR, "moveCursorToCorner, arg has to be a number."); return {.success = false, .error = "moveCursorToCorner, arg has to be a number."}; } const auto CORNER = std::stoi(arg); if (CORNER < 0 || CORNER > 3) { - Debug::log(ERR, "moveCursorToCorner, corner not 0 - 3."); + Log::logger->log(Log::ERR, "moveCursorToCorner, corner not 0 - 3."); return {.success = false, .error = "moveCursorToCorner, corner not 0 - 3."}; } @@ -1875,7 +1875,7 @@ SDispatchResult CKeybindManager::moveCursor(std::string args) { size_t i = args.find_first_of(' '); if (i == std::string::npos) { - Debug::log(ERR, "moveCursor, takes 2 arguments."); + Log::logger->log(Log::ERR, "moveCursor, takes 2 arguments."); return {.success = false, .error = "moveCursor, takes 2 arguments"}; } @@ -1883,11 +1883,11 @@ SDispatchResult CKeybindManager::moveCursor(std::string args) { y_str = args.substr(i + 1); if (!isNumber(x_str)) { - Debug::log(ERR, "moveCursor, x argument has to be a number."); + Log::logger->log(Log::ERR, "moveCursor, x argument has to be a number."); return {.success = false, .error = "moveCursor, x argument has to be a number."}; } if (!isNumber(y_str)) { - Debug::log(ERR, "moveCursor, y argument has to be a number."); + Log::logger->log(Log::ERR, "moveCursor, y argument has to be a number."); return {.success = false, .error = "moveCursor, y argument has to be a number."}; } @@ -1945,7 +1945,7 @@ SDispatchResult CKeybindManager::workspaceOpt(std::string args) { } } } else { - Debug::log(ERR, "Invalid arg in workspaceOpt, opt \"{}\" doesn't exist.", args); + Log::logger->log(Log::ERR, "Invalid arg in workspaceOpt, opt \"{}\" doesn't exist.", args); return {.success = false, .error = std::format("Invalid arg in workspaceOpt, opt \"{}\" doesn't exist.", args)}; } @@ -1970,7 +1970,7 @@ SDispatchResult CKeybindManager::renameWorkspace(std::string args) { else return {.success = false, .error = "No such workspace"}; } catch (std::exception& e) { - Debug::log(ERR, R"(Invalid arg in renameWorkspace, expected numeric id only or a numeric id and string name. "{}": "{}")", args, e.what()); + Log::logger->log(Log::ERR, R"(Invalid arg in renameWorkspace, expected numeric id only or a numeric id and string name. "{}": "{}")", args, e.what()); return {.success = false, .error = std::format(R"(Invalid arg in renameWorkspace, expected numeric id only or a numeric id and string name. "{}": "{}")", args, e.what())}; } @@ -1991,14 +1991,14 @@ SDispatchResult CKeybindManager::moveCurrentWorkspaceToMonitor(std::string args) PHLMONITOR PMONITOR = g_pCompositor->getMonitorFromString(args); if (!PMONITOR) { - Debug::log(ERR, "Ignoring moveCurrentWorkspaceToMonitor: monitor doesn't exist"); + Log::logger->log(Log::ERR, "Ignoring moveCurrentWorkspaceToMonitor: monitor doesn't exist"); return {.success = false, .error = "Ignoring moveCurrentWorkspaceToMonitor: monitor doesn't exist"}; } // get the current workspace const auto PCURRENTWORKSPACE = Desktop::focusState()->monitor()->m_activeWorkspace; if (!PCURRENTWORKSPACE) { - Debug::log(ERR, "moveCurrentWorkspaceToMonitor invalid workspace!"); + Log::logger->log(Log::ERR, "moveCurrentWorkspaceToMonitor invalid workspace!"); return {.success = false, .error = "moveCurrentWorkspaceToMonitor invalid workspace!"}; } @@ -2017,21 +2017,21 @@ SDispatchResult CKeybindManager::moveWorkspaceToMonitor(std::string args) { const auto PMONITOR = g_pCompositor->getMonitorFromString(monitor); if (!PMONITOR) { - Debug::log(ERR, "Ignoring moveWorkspaceToMonitor: monitor doesn't exist"); + Log::logger->log(Log::ERR, "Ignoring moveWorkspaceToMonitor: monitor doesn't exist"); return {.success = false, .error = "Ignoring moveWorkspaceToMonitor: monitor doesn't exist"}; } const auto WORKSPACEID = getWorkspaceIDNameFromString(workspace).id; if (WORKSPACEID == WORKSPACE_INVALID) { - Debug::log(ERR, "moveWorkspaceToMonitor invalid workspace!"); + Log::logger->log(Log::ERR, "moveWorkspaceToMonitor invalid workspace!"); return {.success = false, .error = "moveWorkspaceToMonitor invalid workspace!"}; } const auto PWORKSPACE = g_pCompositor->getWorkspaceByID(WORKSPACEID); if (!PWORKSPACE) { - Debug::log(ERR, "moveWorkspaceToMonitor workspace doesn't exist!"); + Log::logger->log(Log::ERR, "moveWorkspaceToMonitor workspace doesn't exist!"); return {.success = false, .error = "moveWorkspaceToMonitor workspace doesn't exist!"}; } @@ -2043,14 +2043,14 @@ SDispatchResult CKeybindManager::moveWorkspaceToMonitor(std::string args) { SDispatchResult CKeybindManager::focusWorkspaceOnCurrentMonitor(std::string args) { auto [workspaceID, workspaceName, isAutoID] = getWorkspaceIDNameFromString(args); if (workspaceID == WORKSPACE_INVALID) { - Debug::log(ERR, "focusWorkspaceOnCurrentMonitor invalid workspace!"); + Log::logger->log(Log::ERR, "focusWorkspaceOnCurrentMonitor invalid workspace!"); return {.success = false, .error = "focusWorkspaceOnCurrentMonitor invalid workspace!"}; } const auto PCURRMONITOR = Desktop::focusState()->monitor(); if (!PCURRMONITOR) { - Debug::log(ERR, "focusWorkspaceOnCurrentMonitor monitor doesn't exist!"); + Log::logger->log(Log::ERR, "focusWorkspaceOnCurrentMonitor monitor doesn't exist!"); return {.success = false, .error = "focusWorkspaceOnCurrentMonitor monitor doesn't exist!"}; } @@ -2078,7 +2078,7 @@ SDispatchResult CKeybindManager::focusWorkspaceOnCurrentMonitor(std::string args if (pWorkspace->m_monitor != PCURRMONITOR) { const auto POLDMONITOR = pWorkspace->m_monitor.lock(); if (!POLDMONITOR) { // wat - Debug::log(ERR, "focusWorkspaceOnCurrentMonitor old monitor doesn't exist!"); + Log::logger->log(Log::ERR, "focusWorkspaceOnCurrentMonitor old monitor doesn't exist!"); return {.success = false, .error = "focusWorkspaceOnCurrentMonitor old monitor doesn't exist!"}; } if (POLDMONITOR->activeWorkspaceID() == workspaceID) { @@ -2097,7 +2097,7 @@ SDispatchResult CKeybindManager::focusWorkspaceOnCurrentMonitor(std::string args SDispatchResult CKeybindManager::toggleSpecialWorkspace(std::string args) { const auto& [workspaceID, workspaceName, isAutoID] = getWorkspaceIDNameFromString("special:" + args); if (workspaceID == WORKSPACE_INVALID || !g_pCompositor->isWorkspaceSpecial(workspaceID)) { - Debug::log(ERR, "Invalid workspace passed to special"); + Log::logger->log(Log::ERR, "Invalid workspace passed to special"); return {.success = false, .error = "Invalid workspace passed to special"}; } @@ -2118,12 +2118,12 @@ SDispatchResult CKeybindManager::toggleSpecialWorkspace(std::string args) { if (requestedWorkspaceIsAlreadyOpen && specialOpenOnMonitor == workspaceID) { // already open on this monitor - Debug::log(LOG, "Toggling special workspace {} to closed", workspaceID); + Log::logger->log(Log::DEBUG, "Toggling special workspace {} to closed", workspaceID); PMONITOR->setSpecialWorkspace(nullptr); focusedWorkspace = PMONITOR->m_activeWorkspace; } else { - Debug::log(LOG, "Toggling special workspace {} to open", workspaceID); + Log::logger->log(Log::DEBUG, "Toggling special workspace {} to open", workspaceID); auto PSPECIALWORKSPACE = g_pCompositor->getWorkspaceByID(workspaceID); if (!PSPECIALWORKSPACE) @@ -2213,7 +2213,7 @@ SDispatchResult CKeybindManager::moveWindow(std::string args) { const auto PWINDOW = g_pCompositor->getWindowByRegex(WINDOWREGEX); if (!PWINDOW) { - Debug::log(ERR, "moveWindow: no window"); + Log::logger->log(Log::ERR, "moveWindow: no window"); return {.success = false, .error = "moveWindow: no window"}; } @@ -2235,7 +2235,7 @@ SDispatchResult CKeybindManager::resizeWindow(std::string args) { const auto PWINDOW = g_pCompositor->getWindowByRegex(WINDOWREGEX); if (!PWINDOW) { - Debug::log(ERR, "resizeWindow: no window"); + Log::logger->log(Log::ERR, "resizeWindow: no window"); return {.success = false, .error = "resizeWindow: no window"}; } @@ -2293,11 +2293,11 @@ SDispatchResult CKeybindManager::focusWindow(std::string regexp) { if (!PWINDOW) return {.success = false, .error = "No such window found"}; - Debug::log(LOG, "Focusing to window name: {}", PWINDOW->m_title); + Log::logger->log(Log::DEBUG, "Focusing to window name: {}", PWINDOW->m_title); const auto PWORKSPACE = PWINDOW->m_workspace; if (!PWORKSPACE) { - Debug::log(ERR, "BUG THIS: null workspace in focusWindow"); + Log::logger->log(Log::ERR, "BUG THIS: null workspace in focusWindow"); return {.success = false, .error = "BUG THIS: null workspace in focusWindow"}; } @@ -2305,7 +2305,7 @@ SDispatchResult CKeybindManager::focusWindow(std::string regexp) { if (Desktop::focusState()->monitor() && Desktop::focusState()->monitor()->m_activeWorkspace != PWINDOW->m_workspace && Desktop::focusState()->monitor()->m_activeSpecialWorkspace != PWINDOW->m_workspace) { - Debug::log(LOG, "Fake executing workspace to move focus"); + Log::logger->log(Log::DEBUG, "Fake executing workspace to move focus"); changeworkspace(PWORKSPACE->getConfigName()); } @@ -2359,7 +2359,7 @@ SDispatchResult CKeybindManager::toggleSwallow(std::string args) { SDispatchResult CKeybindManager::setSubmap(std::string submap) { if (submap == "reset" || submap.empty()) { m_currentSelectedSubmap.name = ""; - Debug::log(LOG, "Reset active submap to the default one."); + Log::logger->log(Log::DEBUG, "Reset active submap to the default one."); g_pEventManager->postEvent(SHyprIPCEvent{"submap", ""}); EMIT_HOOK_EVENT("submap", m_currentSelectedSubmap.name); return {}; @@ -2368,14 +2368,14 @@ SDispatchResult CKeybindManager::setSubmap(std::string submap) { for (const auto& k : g_pKeybindManager->m_keybinds) { if (k->submap.name == submap) { m_currentSelectedSubmap.name = submap; - Debug::log(LOG, "Changed keybind submap to {}", submap); + Log::logger->log(Log::DEBUG, "Changed keybind submap to {}", submap); g_pEventManager->postEvent(SHyprIPCEvent{"submap", submap}); EMIT_HOOK_EVENT("submap", m_currentSelectedSubmap.name); return {}; } } - Debug::log(ERR, "Cannot set submap {}, submap doesn't exist (wasn't registered!)", submap); + Log::logger->log(Log::ERR, "Cannot set submap {}, submap doesn't exist (wasn't registered!)", submap); return {.success = false, .error = std::format("Cannot set submap {}, submap doesn't exist (wasn't registered!)", submap)}; } @@ -2385,12 +2385,12 @@ SDispatchResult CKeybindManager::pass(std::string regexp) { const auto PWINDOW = g_pCompositor->getWindowByRegex(regexp); if (!PWINDOW) { - Debug::log(ERR, "pass: window not found"); + Log::logger->log(Log::ERR, "pass: window not found"); return {.success = false, .error = "pass: window not found"}; } if (!g_pSeatManager->m_keyboard) { - Debug::log(ERR, "No kb in pass?"); + Log::logger->log(Log::ERR, "No kb in pass?"); return {.success = false, .error = "No kb in pass?"}; } @@ -2459,7 +2459,7 @@ SDispatchResult CKeybindManager::sendshortcut(std::string args) { // args=<NEW_MODKEYS><NEW_KEY>[,WINDOW_RULES] const auto ARGS = CVarList(args, 3); if (ARGS.size() != 3) { - Debug::log(ERR, "sendshortcut: invalid args"); + Log::logger->log(Log::ERR, "sendshortcut: invalid args"); return {.success = false, .error = "sendshortcut: invalid args"}; } @@ -2477,7 +2477,7 @@ SDispatchResult CKeybindManager::sendshortcut(std::string args) { keycode = std::stoi(KEY.substr(6)); isMouse = true; if (keycode < 272) { - Debug::log(ERR, "sendshortcut: invalid mouse button"); + Log::logger->log(Log::ERR, "sendshortcut: invalid mouse button"); return {.success = false, .error = "sendshortcut: invalid mouse button"}; } } else { @@ -2492,7 +2492,7 @@ SDispatchResult CKeybindManager::sendshortcut(std::string args) { const auto KB = g_pSeatManager->m_keyboard; if (!KB) { - Debug::log(ERR, "sendshortcut: no kb"); + Log::logger->log(Log::ERR, "sendshortcut: no kb"); return {.success = false, .error = "sendshortcut: no kb"}; } @@ -2516,7 +2516,7 @@ SDispatchResult CKeybindManager::sendshortcut(std::string args) { } if (!keycode) { - Debug::log(ERR, "sendshortcut: key not found"); + Log::logger->log(Log::ERR, "sendshortcut: key not found"); return {.success = false, .error = "sendshortcut: key not found"}; } @@ -2525,7 +2525,7 @@ SDispatchResult CKeybindManager::sendshortcut(std::string args) { } if (!keycode) { - Debug::log(ERR, "sendshortcut: invalid key"); + Log::logger->log(Log::ERR, "sendshortcut: invalid key"); return {.success = false, .error = "sendshortcut: invalid key"}; } @@ -2539,12 +2539,12 @@ SDispatchResult CKeybindManager::sendshortcut(std::string args) { PWINDOW = g_pCompositor->getWindowByRegex(regexp); if (!PWINDOW) { - Debug::log(ERR, "sendshortcut: window not found"); + Log::logger->log(Log::ERR, "sendshortcut: window not found"); return {.success = false, .error = "sendshortcut: window not found"}; } if (!g_pSeatManager->m_keyboard) { - Debug::log(ERR, "No kb in sendshortcut?"); + Log::logger->log(Log::ERR, "No kb in sendshortcut?"); return {.success = false, .error = "No kb in sendshortcut?"}; } @@ -2704,7 +2704,7 @@ SDispatchResult CKeybindManager::pinActive(std::string args) { PWINDOW = Desktop::focusState()->window(); if (!PWINDOW) { - Debug::log(ERR, "pin: window not found"); + Log::logger->log(Log::ERR, "pin: window not found"); return {.success = false, .error = "pin: window not found"}; } @@ -2716,7 +2716,7 @@ SDispatchResult CKeybindManager::pinActive(std::string args) { const auto PMONITOR = PWINDOW->m_monitor.lock(); if (!PMONITOR) { - Debug::log(ERR, "pin: monitor not found"); + Log::logger->log(Log::ERR, "pin: monitor not found"); return {.success = false, .error = "pin: window not found"}; } @@ -2803,7 +2803,7 @@ SDispatchResult CKeybindManager::alterZOrder(std::string args) { PWINDOW = Desktop::focusState()->window(); if (!PWINDOW) { - Debug::log(ERR, "alterZOrder: no window"); + Log::logger->log(Log::ERR, "alterZOrder: no window"); return {.success = false, .error = "alterZOrder: no window"}; } @@ -2812,7 +2812,7 @@ SDispatchResult CKeybindManager::alterZOrder(std::string args) { else if (POSITION == "bottom") g_pCompositor->changeWindowZOrder(PWINDOW, false); else { - Debug::log(ERR, "alterZOrder: bad position: {}", POSITION); + Log::logger->log(Log::ERR, "alterZOrder: bad position: {}", POSITION); return {.success = false, .error = "alterZOrder: bad position: {}"}; } @@ -2933,7 +2933,7 @@ SDispatchResult CKeybindManager::moveIntoGroup(std::string args) { return {}; if (!isDirection(args)) { - Debug::log(ERR, "Cannot move into group in direction {}, unsupported direction. Supported: l,r,u/t,d/b", arg); + Log::logger->log(Log::ERR, "Cannot move into group in direction {}, unsupported direction. Supported: l,r,u/t,d/b", arg); return {.success = false, .error = std::format("Cannot move into group in direction {}, unsupported direction. Supported: l,r,u/t,d/b", arg)}; } @@ -2986,7 +2986,7 @@ SDispatchResult CKeybindManager::moveWindowOrGroup(std::string args) { static auto PIGNOREGROUPLOCK = CConfigValue<Hyprlang::INT>("binds:ignore_group_lock"); if (!isDirection(args)) { - Debug::log(ERR, "Cannot move into group in direction {}, unsupported direction. Supported: l,r,u/t,d/b", arg); + Log::logger->log(Log::ERR, "Cannot move into group in direction {}, unsupported direction. Supported: l,r,u/t,d/b", arg); return {.success = false, .error = std::format("Cannot move into group in direction {}, unsupported direction. Supported: l,r,u/t,d/b", arg)}; } @@ -3138,7 +3138,7 @@ static void parsePropTrivial(Desktop::Types::COverridableVar<T>& prop, const std prop = Desktop::Types::COverridableVar<T>(std::stof(s), Desktop::Types::PRIORITY_SET_PROP); } else if constexpr (std::is_same_v<T, std::string>) prop = Desktop::Types::COverridableVar<T>(s, Desktop::Types::PRIORITY_SET_PROP); - } catch (...) { Debug::log(ERR, "Hyprctl: parsePropTrivial: failed to parse setprop for {}", s); } + } catch (...) { Log::logger->log(Log::ERR, "Hyprctl: parsePropTrivial: failed to parse setprop for {}", s); } } SDispatchResult CKeybindManager::setProp(std::string args) { @@ -3302,7 +3302,7 @@ SDispatchResult CKeybindManager::forceIdle(std::string args) { std::optional<float> duration = getPlusMinusKeywordResult(args, 0); if (!duration.has_value()) { - Debug::log(ERR, "Duration invalid in forceIdle!"); + Log::logger->log(Log::ERR, "Duration invalid in forceIdle!"); return {.success = false, .error = "Duration invalid in forceIdle!"}; } @@ -3315,14 +3315,14 @@ SDispatchResult CKeybindManager::sendkeystate(std::string args) { // args=<NEW_MODKEYS><NEW_KEY><STATE>[,WINDOW_RULES] const auto ARGS = CVarList(args, 4); if (ARGS.size() != 4) { - Debug::log(ERR, "sendkeystate: invalid args"); + Log::logger->log(Log::ERR, "sendkeystate: invalid args"); return {.success = false, .error = "sendkeystate: invalid args"}; } const auto STATE = ARGS[2]; if (STATE != "down" && STATE != "repeat" && STATE != "up") { - Debug::log(ERR, "sendkeystate: invalid state, must be 'down', 'repeat', or 'up'"); + Log::logger->log(Log::ERR, "sendkeystate: invalid state, must be 'down', 'repeat', or 'up'"); return {.success = false, .error = "sendkeystate: invalid state, must be 'down', 'repeat', or 'up'"}; } diff --git a/src/managers/LayoutManager.cpp b/src/managers/LayoutManager.cpp index 449d1700..050f1d50 100644 --- a/src/managers/LayoutManager.cpp +++ b/src/managers/LayoutManager.cpp @@ -22,7 +22,7 @@ void CLayoutManager::switchToLayout(std::string layout) { } } - Debug::log(ERR, "Unknown layout!"); + Log::logger->log(Log::ERR, "Unknown layout!"); } bool CLayoutManager::addLayout(const std::string& name, IHyprLayout* layout) { @@ -31,7 +31,7 @@ bool CLayoutManager::addLayout(const std::string& name, IHyprLayout* layout) { m_layouts.emplace_back(std::make_pair<>(name, layout)); - Debug::log(LOG, "Added new layout {} at {:x}", name, rc<uintptr_t>(layout)); + Log::logger->log(Log::DEBUG, "Added new layout {} at {:x}", name, rc<uintptr_t>(layout)); return true; } @@ -45,7 +45,7 @@ bool CLayoutManager::removeLayout(IHyprLayout* layout) { if (m_currentLayoutID == IT - m_layouts.begin()) switchToLayout("dwindle"); - Debug::log(LOG, "Removed a layout {} at {:x}", IT->first, rc<uintptr_t>(layout)); + Log::logger->log(Log::DEBUG, "Removed a layout {} at {:x}", IT->first, rc<uintptr_t>(layout)); std::erase(m_layouts, *IT); diff --git a/src/managers/PointerManager.cpp b/src/managers/PointerManager.cpp index f949e6ce..1a915506 100644 --- a/src/managers/PointerManager.cpp +++ b/src/managers/PointerManager.cpp @@ -243,7 +243,7 @@ void CPointerManager::resetCursorImage(bool apply) { for (auto const& ms : m_monitorStates) { if (!ms->monitor || !ms->monitor->m_enabled || !ms->monitor->m_dpmsStatus) { - Debug::log(TRACE, "Not updating hw cursors: disabled / dpms off display"); + Log::logger->log(Log::TRACE, "Not updating hw cursors: disabled / dpms off display"); continue; } @@ -260,7 +260,7 @@ void CPointerManager::updateCursorBackend() { for (auto const& m : g_pCompositor->m_monitors) { if (!m->m_enabled || !m->m_dpmsStatus) { - Debug::log(TRACE, "Not updating hw cursors: disabled / dpms off display"); + Log::logger->log(Log::TRACE, "Not updating hw cursors: disabled / dpms off display"); continue; } @@ -275,7 +275,7 @@ void CPointerManager::updateCursorBackend() { } if (state->softwareLocks > 0 || g_pConfigManager->shouldUseSoftwareCursors(m) || !attemptHardwareCursor(state)) { - Debug::log(TRACE, "Output {} rejected hardware cursors, falling back to sw", m->m_name); + Log::logger->log(Log::TRACE, "Output {} rejected hardware cursors, falling back to sw", m->m_name); state->box = getCursorBoxLogicalForMonitor(state->monitor.lock()); state->hardwareFailed = true; @@ -305,11 +305,11 @@ void CPointerManager::onCursorMoved() { auto CROSSES = !m->logicalBox().intersection(CURSORBOX).empty(); if (!CROSSES && state->cursorFrontBuffer) { - Debug::log(TRACE, "onCursorMoved for output {}: cursor left the viewport, removing it from the backend", m->m_name); + Log::logger->log(Log::TRACE, "onCursorMoved for output {}: cursor left the viewport, removing it from the backend", m->m_name); setHWCursorBuffer(state, nullptr); continue; } else if (CROSSES && !state->cursorFrontBuffer) { - Debug::log(TRACE, "onCursorMoved for output {}: cursor entered the output, but no front buffer, forcing recalc", m->m_name); + Log::logger->log(Log::TRACE, "onCursorMoved for output {}: cursor entered the output, but no front buffer, forcing recalc", m->m_name); recalc = true; } @@ -343,7 +343,7 @@ bool CPointerManager::attemptHardwareCursor(SP<CPointerManager::SMonitorPointerS auto texture = getCurrentCursorTexture(); if (!texture) { - Debug::log(TRACE, "[pointer] no texture for hw cursor -> hiding"); + Log::logger->log(Log::TRACE, "[pointer] no texture for hw cursor -> hiding"); setHWCursorBuffer(state, nullptr); return true; } @@ -351,7 +351,7 @@ bool CPointerManager::attemptHardwareCursor(SP<CPointerManager::SMonitorPointerS auto buffer = renderHWCursorBuffer(state, texture); if (!buffer) { - Debug::log(TRACE, "[pointer] hw cursor failed rendering"); + Log::logger->log(Log::TRACE, "[pointer] hw cursor failed rendering"); setHWCursorBuffer(state, nullptr); return false; } @@ -359,7 +359,7 @@ bool CPointerManager::attemptHardwareCursor(SP<CPointerManager::SMonitorPointerS bool success = setHWCursorBuffer(state, buffer); if (!success) { - Debug::log(TRACE, "[pointer] hw cursor failed applying, hiding"); + Log::logger->log(Log::TRACE, "[pointer] hw cursor failed applying, hiding"); setHWCursorBuffer(state, nullptr); return false; } else @@ -374,7 +374,7 @@ bool CPointerManager::setHWCursorBuffer(SP<SMonitorPointerState> state, SP<Aquam const auto HOTSPOT = transformedHotspot(state->monitor.lock()); - Debug::log(TRACE, "[pointer] hw transformed hotspot for {}: {}", state->monitor->m_name, HOTSPOT); + Log::logger->log(Log::TRACE, "[pointer] hw transformed hotspot for {}: {}", state->monitor->m_name, HOTSPOT); if (!state->monitor->m_output->setCursor(buf, HOTSPOT)) return false; @@ -402,7 +402,7 @@ SP<Aquamarine::IBuffer> CPointerManager::renderHWCursorBuffer(SP<CPointerManager if (maxSize != Vector2D{-1, -1}) { if (cursorSize.x > maxSize.x || cursorSize.y > maxSize.y) { - Debug::log(TRACE, "hardware cursor too big! {} > {}", m_currentCursorImage.size, maxSize); + Log::logger->log(Log::TRACE, "hardware cursor too big! {} > {}", m_currentCursorImage.size, maxSize); return nullptr; } } else @@ -440,7 +440,7 @@ SP<Aquamarine::IBuffer> CPointerManager::renderHWCursorBuffer(SP<CPointerManager options.format = DRM_FORMAT_ARGB8888; if (!state->monitor->m_cursorSwapchain->reconfigure(options)) { - Debug::log(TRACE, "Failed to reconfigure cursor swapchain"); + Log::logger->log(Log::TRACE, "Failed to reconfigure cursor swapchain"); return nullptr; } } @@ -455,7 +455,7 @@ SP<Aquamarine::IBuffer> CPointerManager::renderHWCursorBuffer(SP<CPointerManager auto buf = state->monitor->m_cursorSwapchain->next(nullptr); if (!buf) { - Debug::log(TRACE, "Failed to acquire a buffer from the cursor swapchain"); + Log::logger->log(Log::TRACE, "Failed to acquire a buffer from the cursor swapchain"); return nullptr; } @@ -470,12 +470,12 @@ SP<Aquamarine::IBuffer> CPointerManager::renderHWCursorBuffer(SP<CPointerManager bool flipRB = false; if (SURFACE->m_current.texture) { - Debug::log(TRACE, "Cursor CPU surface: format {}, expecting AR24", NFormatUtils::drmFormatName(SURFACE->m_current.texture->m_drmFormat)); + Log::logger->log(Log::TRACE, "Cursor CPU surface: format {}, expecting AR24", NFormatUtils::drmFormatName(SURFACE->m_current.texture->m_drmFormat)); if (SURFACE->m_current.texture->m_drmFormat == DRM_FORMAT_ABGR8888) { - Debug::log(TRACE, "Cursor CPU surface format AB24, will flip. WARNING: this will break on big endian!"); + Log::logger->log(Log::TRACE, "Cursor CPU surface format AB24, will flip. WARNING: this will break on big endian!"); flipRB = true; } else if (SURFACE->m_current.texture->m_drmFormat != DRM_FORMAT_ARGB8888) { - Debug::log(TRACE, "Cursor CPU surface format rejected, falling back to sw"); + Log::logger->log(Log::TRACE, "Cursor CPU surface format rejected, falling back to sw"); return nullptr; } } @@ -493,7 +493,7 @@ SP<Aquamarine::IBuffer> CPointerManager::renderHWCursorBuffer(SP<CPointerManager } } } else { - Debug::log(TRACE, "Cannot use dumb copy on dmabuf cursor buffers"); + Log::logger->log(Log::TRACE, "Cannot use dumb copy on dmabuf cursor buffers"); return nullptr; } } @@ -566,7 +566,7 @@ SP<Aquamarine::IBuffer> CPointerManager::renderHWCursorBuffer(SP<CPointerManager auto RBO = g_pHyprRenderer->getOrCreateRenderbuffer(buf, state->monitor->m_cursorSwapchain->currentOptions().format); if (!RBO) { - Debug::log(TRACE, "Failed to create cursor RB with format {}, mod {}", buf->dmabuf().format, buf->dmabuf().modifier); + Log::logger->log(Log::TRACE, "Failed to create cursor RB with format {}, mod {}", buf->dmabuf().format, buf->dmabuf().modifier); return nullptr; } @@ -576,8 +576,8 @@ SP<Aquamarine::IBuffer> CPointerManager::renderHWCursorBuffer(SP<CPointerManager g_pHyprOpenGL->clear(CHyprColor{0.F, 0.F, 0.F, 0.F}); CBox xbox = {{}, Vector2D{m_currentCursorImage.size / m_currentCursorImage.scale * state->monitor->m_scale}.round()}; - Debug::log(TRACE, "[pointer] monitor: {}, size: {}, hw buf: {}, scale: {:.2f}, monscale: {:.2f}, xbox: {}", state->monitor->m_name, m_currentCursorImage.size, cursorSize, - m_currentCursorImage.scale, state->monitor->m_scale, xbox.size()); + Log::logger->log(Log::TRACE, "[pointer] monitor: {}, size: {}, hw buf: {}, scale: {:.2f}, monscale: {:.2f}, xbox: {}", state->monitor->m_name, m_currentCursorImage.size, + cursorSize, m_currentCursorImage.scale, state->monitor->m_scale, xbox.size()); g_pHyprOpenGL->renderTexture(texture, xbox, {}); @@ -989,7 +989,7 @@ void CPointerManager::attachPointer(SP<IPointer> pointer) { PROTO::idle->onActivity(); }); - Debug::log(LOG, "Attached pointer {} to global", pointer->m_hlName); + Log::logger->log(Log::DEBUG, "Attached pointer {} to global", pointer->m_hlName); } void CPointerManager::attachTouch(SP<ITouch> touch) { @@ -1030,7 +1030,7 @@ void CPointerManager::attachTouch(SP<ITouch> touch) { listener->frame = touch->m_touchEvents.frame.listen([] { g_pSeatManager->sendTouchFrame(); }); - Debug::log(LOG, "Attached touch {} to global", touch->m_hlName); + Log::logger->log(Log::DEBUG, "Attached touch {} to global", touch->m_hlName); } void CPointerManager::attachTablet(SP<CTablet> tablet) { @@ -1075,7 +1075,7 @@ void CPointerManager::attachTablet(SP<CTablet> tablet) { }); // clang-format on - Debug::log(LOG, "Attached tablet {} to global", tablet->m_hlName); + Log::logger->log(Log::DEBUG, "Attached tablet {} to global", tablet->m_hlName); } void CPointerManager::detachPointer(SP<IPointer> pointer) { diff --git a/src/managers/ProtocolManager.cpp b/src/managers/ProtocolManager.cpp index 0f27ffd6..b41fc37f 100644 --- a/src/managers/ProtocolManager.cpp +++ b/src/managers/ProtocolManager.cpp @@ -99,7 +99,7 @@ void CProtocolManager::onMonitorModeChange(PHLMONITOR pMonitor) { } if (PROTO::colorManagement && g_pCompositor->shouldChangePreferredImageDescription()) { - Debug::log(ERR, "FIXME: color management protocol is enabled, need a preferred image description id"); + Log::logger->log(Log::ERR, "FIXME: color management protocol is enabled, need a preferred image description id"); PROTO::colorManagement->onImagePreferredChanged(0); } } @@ -222,9 +222,9 @@ CProtocolManager::CProtocolManager() { if (g_pHyprOpenGL->m_exts.EGL_ANDROID_native_fence_sync_ext && !PROTO::sync) { if (g_pCompositor->supportsDrmSyncobjTimeline()) { PROTO::sync = makeUnique<CDRMSyncobjProtocol>(&wp_linux_drm_syncobj_manager_v1_interface, 1, "DRMSyncobj"); - Debug::log(LOG, "DRM Syncobj Timeline support detected, enabling explicit sync protocol"); + Log::logger->log(Log::DEBUG, "DRM Syncobj Timeline support detected, enabling explicit sync protocol"); } else - Debug::log(WARN, "DRM Syncobj Timeline not supported, skipping explicit sync protocol"); + Log::logger->log(Log::WARN, "DRM Syncobj Timeline not supported, skipping explicit sync protocol"); } } @@ -232,7 +232,7 @@ CProtocolManager::CProtocolManager() { PROTO::mesaDRM = makeUnique<CMesaDRMProtocol>(&wl_drm_interface, 2, "MesaDRM"); PROTO::linuxDma = makeUnique<CLinuxDMABufV1Protocol>(&zwp_linux_dmabuf_v1_interface, 5, "LinuxDMABUF"); } else - Debug::log(WARN, "ProtocolManager: Not binding linux-dmabuf and MesaDRM: DMABUF not available"); + Log::logger->log(Log::WARN, "ProtocolManager: Not binding linux-dmabuf and MesaDRM: DMABUF not available"); } CProtocolManager::~CProtocolManager() { diff --git a/src/managers/SeatManager.cpp b/src/managers/SeatManager.cpp index 0f4ea93c..f40c55e3 100644 --- a/src/managers/SeatManager.cpp +++ b/src/managers/SeatManager.cpp @@ -114,7 +114,7 @@ void CSeatManager::setKeyboardFocus(SP<CWLSurfaceResource> surf) { return; if (!m_keyboard) { - Debug::log(ERR, "BUG THIS: setKeyboardFocus without a valid keyboard set"); + Log::logger->log(Log::ERR, "BUG THIS: setKeyboardFocus without a valid keyboard set"); return; } @@ -217,14 +217,14 @@ void CSeatManager::setPointerFocus(SP<CWLSurfaceResource> surf, const Vector2D& if (PROTO::data->dndActive() && surf) { if (m_state.dndPointerFocus == surf) return; - Debug::log(LOG, "[seatmgr] Refusing pointer focus during an active dnd, but setting dndPointerFocus"); + Log::logger->log(Log::DEBUG, "[seatmgr] Refusing pointer focus during an active dnd, but setting dndPointerFocus"); m_state.dndPointerFocus = surf; m_events.dndPointerFocusChange.emit(); return; } if (!m_mouse) { - Debug::log(ERR, "BUG THIS: setPointerFocus without a valid mouse set"); + Log::logger->log(Log::ERR, "BUG THIS: setPointerFocus without a valid mouse set"); return; } @@ -545,13 +545,13 @@ void CSeatManager::refocusGrab() { void CSeatManager::onSetCursor(SP<CWLSeatResource> seatResource, uint32_t serial, SP<CWLSurfaceResource> surf, const Vector2D& hotspot) { if (!m_state.pointerFocusResource || !seatResource || seatResource->client() != m_state.pointerFocusResource->client()) { - Debug::log(LOG, "[seatmgr] Rejecting a setCursor because the client ain't in focus"); + Log::logger->log(Log::DEBUG, "[seatmgr] Rejecting a setCursor because the client ain't in focus"); return; } // TODO: fix this. Probably should be done in the CWlPointer as the serial could be lost by us. // if (!serialValid(seatResource, serial)) { - // Debug::log(LOG, "[seatmgr] Rejecting a setCursor because the serial is invalid"); + // Log::logger->log(Log::DEBUG, "[seatmgr] Rejecting a setCursor because the serial is invalid"); // return; // } @@ -564,7 +564,7 @@ SP<CWLSeatResource> CSeatManager::seatResourceForClient(wl_client* client) { void CSeatManager::setCurrentSelection(SP<IDataSource> source) { if (source == m_selection.currentSelection) { - Debug::log(WARN, "[seat] duplicated setCurrentSelection?"); + Log::logger->log(Log::WARN, "[seat] duplicated setCurrentSelection?"); return; } @@ -590,7 +590,7 @@ void CSeatManager::setCurrentSelection(SP<IDataSource> source) { void CSeatManager::setCurrentPrimarySelection(SP<IDataSource> source) { if (source == m_selection.currentPrimarySelection) { - Debug::log(WARN, "[seat] duplicated setCurrentPrimarySelection?"); + Log::logger->log(Log::WARN, "[seat] duplicated setCurrentPrimarySelection?"); return; } @@ -661,7 +661,7 @@ void CSeatManager::setGrab(SP<CSeatGrab> grab) { // If this was a popup grab, focus its parent window to maintain context if (validMapped(parentWindow)) { Desktop::focusState()->rawWindowFocus(parentWindow); - Debug::log(LOG, "[seatmgr] Refocused popup parent window {} (follow_mouse={})", parentWindow->m_title, *PFOLLOWMOUSE); + Log::logger->log(Log::DEBUG, "[seatmgr] Refocused popup parent window {} (follow_mouse={})", parentWindow->m_title, *PFOLLOWMOUSE); } else g_pInputManager->refocusLastWindow(PMONITOR); } else diff --git a/src/managers/SessionLockManager.cpp b/src/managers/SessionLockManager.cpp index 1b0ec0bd..e729ae95 100644 --- a/src/managers/SessionLockManager.cpp +++ b/src/managers/SessionLockManager.cpp @@ -52,7 +52,7 @@ void CSessionLockManager::onNewSessionLock(SP<CSessionLock> pLock) { static auto PALLOWRELOCK = CConfigValue<Hyprlang::INT>("misc:allow_session_lock_restore"); if (PROTO::sessionLock->isLocked() && !*PALLOWRELOCK) { - LOGM(LOG, "Cannot re-lock, misc:allow_session_lock_restore is disabled"); + LOGM(Log::DEBUG, "Cannot re-lock, misc:allow_session_lock_restore is disabled"); pLock->sendDenied(); return; } @@ -60,7 +60,7 @@ void CSessionLockManager::onNewSessionLock(SP<CSessionLock> pLock) { if (m_sessionLock && !clientDenied() && !clientLocked()) return; // Not allowing to relock in case the old lock is still in a limbo - LOGM(LOG, "Session got locked by {:x}", (uintptr_t)pLock.get()); + LOGM(Log::DEBUG, "Session got locked by {:x}", (uintptr_t)pLock.get()); m_sessionLock = makeUnique<SSessionLock>(); m_sessionLock->lock = pLock; @@ -123,7 +123,7 @@ void CSessionLockManager::onNewSessionLock(SP<CSessionLock> pLock) { return; } - LOGM(WARN, "Kicking lockscreen client, because it failed to render to all outputs within 5 seconds"); + LOGM(Log::WARN, "Kicking lockscreen client, because it failed to render to all outputs within 5 seconds"); g_pSessionLockManager->m_sessionLock->lock->sendDenied(); g_pSessionLockManager->m_sessionLock->hasSentDenied = true; }, diff --git a/src/managers/VersionKeeperManager.cpp b/src/managers/VersionKeeperManager.cpp index 93f820f4..6f94fbe5 100644 --- a/src/managers/VersionKeeperManager.cpp +++ b/src/managers/VersionKeeperManager.cpp @@ -1,5 +1,5 @@ #include "VersionKeeperManager.hpp" -#include "../debug/Log.hpp" +#include "../debug/log/Logger.hpp" #include "../macros.hpp" #include "../version.h" #include "../helpers/MiscFunctions.hpp" @@ -35,19 +35,19 @@ CVersionKeeperManager::CVersionKeeperManager() { } if (!isVersionOlderThanRunning(*LASTVER)) { - Debug::log(LOG, "CVersionKeeperManager: Read version {} matches or is older than running.", *LASTVER); + Log::logger->log(Log::DEBUG, "CVersionKeeperManager: Read version {} matches or is older than running.", *LASTVER); return; } NFsUtils::writeToFile(*DATAROOT + "/" + VERSION_FILE_NAME, HYPRLAND_VERSION); if (*PNONOTIFY) { - Debug::log(LOG, "CVersionKeeperManager: updated, but update news is disabled in the config :("); + Log::logger->log(Log::DEBUG, "CVersionKeeperManager: updated, but update news is disabled in the config :("); return; } if (!NFsUtils::executableExistsInPath("hyprland-update-screen")) { - Debug::log(ERR, "CVersionKeeperManager: hyprland-update-screen doesn't seem to exist, skipping notif about update..."); + Log::logger->log(Log::ERR, "CVersionKeeperManager: hyprland-update-screen doesn't seem to exist, skipping notif about update..."); return; } diff --git a/src/managers/WelcomeManager.cpp b/src/managers/WelcomeManager.cpp index fdbbadfe..7a0b8f7f 100644 --- a/src/managers/WelcomeManager.cpp +++ b/src/managers/WelcomeManager.cpp @@ -1,5 +1,5 @@ #include "WelcomeManager.hpp" -#include "../debug/Log.hpp" +#include "../debug/log/Logger.hpp" #include "../config/ConfigValue.hpp" #include "../helpers/fs/FsUtils.hpp" @@ -11,12 +11,12 @@ CWelcomeManager::CWelcomeManager() { static auto PAUTOGEN = CConfigValue<Hyprlang::INT>("autogenerated"); if (!*PAUTOGEN) { - Debug::log(LOG, "[welcome] skipping, not autogen"); + Log::logger->log(Log::DEBUG, "[welcome] skipping, not autogen"); return; } if (!NFsUtils::executableExistsInPath("hyprland-welcome")) { - Debug::log(LOG, "[welcome] skipping, no welcome app"); + Log::logger->log(Log::DEBUG, "[welcome] skipping, no welcome app"); return; } diff --git a/src/managers/XCursorManager.cpp b/src/managers/XCursorManager.cpp index 5cde1dac..90cd2a32 100644 --- a/src/managers/XCursorManager.cpp +++ b/src/managers/XCursorManager.cpp @@ -13,10 +13,11 @@ extern "C" { #include "config/ConfigValue.hpp" #include "helpers/CursorShapes.hpp" #include "../managers/CursorManager.hpp" -#include "debug/Log.hpp" +#include "debug/log/Logger.hpp" #include "XCursorManager.hpp" #include <memory> #include <variant> +#include <fstream> // clang-format off static std::vector<uint32_t> HYPR_XCURSOR_PIXELS = { @@ -121,7 +122,7 @@ void CXCursorManager::loadTheme(std::string const& name, int size, float scale) auto paths = themePaths(m_themeName); if (paths.empty()) { - Debug::log(ERR, "XCursor librarypath is empty loading standard XCursors"); + Log::logger->log(Log::ERR, "XCursor librarypath is empty loading standard XCursors"); m_cursors = loadStandardCursors(m_themeName, m_lastLoadSize); } else { for (auto const& p : paths) { @@ -129,12 +130,12 @@ void CXCursorManager::loadTheme(std::string const& name, int size, float scale) auto dirCursors = loadAllFromDir(p, m_lastLoadSize); std::ranges::copy_if(dirCursors, std::back_inserter(m_cursors), [this](auto const& p) { return std::ranges::none_of(m_cursors, [&p](auto const& dp) { return dp->shape == p->shape; }); }); - } catch (std::exception& e) { Debug::log(ERR, "XCursor path {} can't be loaded: threw error {}", p, e.what()); } + } catch (std::exception& e) { Log::logger->log(Log::ERR, "XCursor path {} can't be loaded: threw error {}", p, e.what()); } } } if (m_cursors.empty()) { - Debug::log(ERR, "XCursor failed finding any shapes in theme \"{}\".", m_themeName); + Log::logger->log(Log::ERR, "XCursor failed finding any shapes in theme \"{}\".", m_themeName); m_defaultCursor = m_hyprCursor; return; } @@ -147,12 +148,12 @@ void CXCursorManager::loadTheme(std::string const& name, int size, float scale) auto it = std::ranges::find_if(m_cursors, [&legacyName](auto const& c) { return c->shape == legacyName; }); if (it == m_cursors.end()) { - Debug::log(LOG, "XCursor failed to find a legacy shape with name {}, skipping", legacyName); + Log::logger->log(Log::DEBUG, "XCursor failed to find a legacy shape with name {}, skipping", legacyName); continue; } if (std::ranges::any_of(m_cursors, [&shape](auto const& dp) { return dp->shape == shape; })) { - Debug::log(LOG, "XCursor already has a shape {} loaded, skipping", shape); + Log::logger->log(Log::DEBUG, "XCursor already has a shape {} loaded, skipping", shape); continue; } @@ -179,7 +180,7 @@ SP<SXCursors> CXCursorManager::getShape(std::string const& shape, int size, floa return c; } - Debug::log(WARN, "XCursor couldn't find shape {} , using default cursor instead", shape); + Log::logger->log(Log::WARN, "XCursor couldn't find shape {} , using default cursor instead", shape); return m_defaultCursor; } @@ -221,7 +222,7 @@ std::set<std::string> CXCursorManager::themePaths(std::string const& theme) { std::string line; std::vector<std::string> themes; - Debug::log(LOG, "XCursor parsing index.theme {}", indexTheme); + Log::logger->log(Log::DEBUG, "XCursor parsing index.theme {}", indexTheme); while (std::getline(infile, line)) { if (line.empty()) @@ -290,12 +291,12 @@ std::set<std::string> CXCursorManager::themePaths(std::string const& theme) { std::stringstream ss(path); std::string line; - Debug::log(LOG, "XCursor scanning theme {}", t); + Log::logger->log(Log::DEBUG, "XCursor scanning theme {}", t); while (std::getline(ss, line, ':')) { auto p = expandTilde(line + "/" + t + "/cursors"); if (std::filesystem::exists(p) && std::filesystem::is_directory(p)) { - Debug::log(LOG, "XCursor using theme path {}", p); + Log::logger->log(Log::DEBUG, "XCursor using theme path {}", p); paths.insert(p); } @@ -303,7 +304,7 @@ std::set<std::string> CXCursorManager::themePaths(std::string const& theme) { if (std::filesystem::exists(inherit) && std::filesystem::is_regular_file(inherit)) { auto inheritThemes = getInheritThemes(inherit); for (auto const& i : inheritThemes) { - Debug::log(LOG, "XCursor theme {} inherits {}", t, i); + Log::logger->log(Log::DEBUG, "XCursor theme {} inherits {}", t, i); inherits.insert(i); } } @@ -496,11 +497,11 @@ std::vector<SP<SXCursors>> CXCursorManager::loadStandardCursors(std::string cons auto xImages = XcursorShapeLoadImages(i << 1 /* wtf xcursor? */, name.c_str(), size); if (!xImages) { - Debug::log(WARN, "XCursor failed to find a shape with name {}, trying size 24.", shape); + Log::logger->log(Log::WARN, "XCursor failed to find a shape with name {}, trying size 24.", shape); xImages = XcursorShapeLoadImages(i << 1 /* wtf xcursor? */, name.c_str(), 24); if (!xImages) { - Debug::log(WARN, "XCursor failed to find a shape with name {}, skipping", shape); + Log::logger->log(Log::WARN, "XCursor failed to find a shape with name {}, skipping", shape); continue; } } @@ -528,7 +529,7 @@ std::vector<SP<SXCursors>> CXCursorManager::loadAllFromDir(std::string const& pa for (const auto& entry : std::filesystem::directory_iterator(path)) { std::error_code e1, e2; if ((!entry.is_regular_file(e1) && !entry.is_symlink(e2)) || e1 || e2) { - Debug::log(WARN, "XCursor failed to load shape {}: {}", entry.path().stem().string(), e1 ? e1.message() : e2.message()); + Log::logger->log(Log::WARN, "XCursor failed to load shape {}: {}", entry.path().stem().string(), e1 ? e1.message() : e2.message()); continue; } @@ -542,11 +543,11 @@ std::vector<SP<SXCursors>> CXCursorManager::loadAllFromDir(std::string const& pa auto xImages = XcursorFileLoadImages(f.get(), size); if (!xImages) { - Debug::log(WARN, "XCursor failed to load image {}, trying size 24.", full); + Log::logger->log(Log::WARN, "XCursor failed to load image {}, trying size 24.", full); xImages = XcursorFileLoadImages(f.get(), 24); if (!xImages) { - Debug::log(WARN, "XCursor failed to load image {}, skipping", full); + Log::logger->log(Log::WARN, "XCursor failed to load image {}, skipping", full); continue; } } @@ -578,7 +579,7 @@ void CXCursorManager::syncGsettings() { auto* gSettingsSchemaSource = g_settings_schema_source_get_default(); if (!gSettingsSchemaSource) { - Debug::log(WARN, "GSettings default schema source does not exist, can't sync GSettings"); + Log::logger->log(Log::WARN, "GSettings default schema source does not exist, can't sync GSettings"); return false; } @@ -596,14 +597,14 @@ void CXCursorManager::syncGsettings() { using SettingValue = std::variant<std::string, int>; auto setValue = [&checkParamExists](std::string const& paramName, const SettingValue& paramValue, std::string const& category) { if (!checkParamExists(paramName, category)) { - Debug::log(WARN, "GSettings parameter doesn't exist {} in {}", paramName, category); + Log::logger->log(Log::WARN, "GSettings parameter doesn't exist {} in {}", paramName, category); return; } auto* gsettings = g_settings_new(category.c_str()); if (!gsettings) { - Debug::log(WARN, "GSettings failed to allocate new settings with category {}", category); + Log::logger->log(Log::WARN, "GSettings failed to allocate new settings with category {}", category); return; } diff --git a/src/managers/XWaylandManager.cpp b/src/managers/XWaylandManager.cpp index d0cdc6db..ca65e934 100644 --- a/src/managers/XWaylandManager.cpp +++ b/src/managers/XWaylandManager.cpp @@ -30,13 +30,13 @@ void CHyprXWaylandManager::activateSurface(SP<CWLSurfaceResource> pSurface, bool auto HLSurface = Desktop::View::CWLSurface::fromResource(pSurface); if (!HLSurface) { - Debug::log(TRACE, "CHyprXWaylandManager::activateSurface on non-desktop surface, ignoring"); + Log::logger->log(Log::TRACE, "CHyprXWaylandManager::activateSurface on non-desktop surface, ignoring"); return; } const auto PWINDOW = Desktop::View::CWindow::fromView(HLSurface->view()); if (!PWINDOW) { - Debug::log(TRACE, "CHyprXWaylandManager::activateSurface on non-window surface, ignoring"); + Log::logger->log(Log::TRACE, "CHyprXWaylandManager::activateSurface on non-window surface, ignoring"); return; } diff --git a/src/managers/animation/DesktopAnimationManager.cpp b/src/managers/animation/DesktopAnimationManager.cpp index 6c0f9222..333df7e7 100644 --- a/src/managers/animation/DesktopAnimationManager.cpp +++ b/src/managers/animation/DesktopAnimationManager.cpp @@ -279,7 +279,7 @@ void CDesktopAnimationManager::startAnimation(PHLWORKSPACE ws, eAnimationType ty if (percstr.ends_with('%')) { try { movePerc = std::stoi(percstr.substr(0, percstr.length() - 1)); - } catch (std::exception& e) { Debug::log(ERR, "Error in startAnim: invalid percentage"); } + } catch (std::exception& e) { Log::logger->log(Log::ERR, "Error in startAnim: invalid percentage"); } } if (ANIMSTYLE.starts_with("slidefade")) { diff --git a/src/managers/eventLoop/EventLoopManager.cpp b/src/managers/eventLoop/EventLoopManager.cpp index 1426e424..496cbb83 100644 --- a/src/managers/eventLoop/EventLoopManager.cpp +++ b/src/managers/eventLoop/EventLoopManager.cpp @@ -1,5 +1,5 @@ #include "EventLoopManager.hpp" -#include "../../debug/Log.hpp" +#include "../../debug/log/Logger.hpp" #include "../../Compositor.hpp" #include "../../config/ConfigWatcher.hpp" @@ -57,7 +57,7 @@ static int configWatcherWrite(int fd, uint32_t mask, void* data) { static int handleWaiterFD(int fd, uint32_t mask, void* data) { if (mask & (WL_EVENT_HANGUP | WL_EVENT_ERROR)) { - Debug::log(ERR, "handleWaiterFD: readable waiter error"); + Log::logger->log(Log::ERR, "handleWaiterFD: readable waiter error"); return 0; } @@ -96,7 +96,7 @@ void CEventLoopManager::enterLoop() { wl_display_run(m_wayland.display); - Debug::log(LOG, "Kicked off the event loop! :("); + Log::logger->log(Log::DEBUG, "Kicked off the event loop! :("); } void CEventLoopManager::onTimerFire() { diff --git a/src/managers/input/IdleInhibitor.cpp b/src/managers/input/IdleInhibitor.cpp index 5750080c..02eefc1d 100644 --- a/src/managers/input/IdleInhibitor.cpp +++ b/src/managers/input/IdleInhibitor.cpp @@ -8,7 +8,7 @@ void CInputManager::newIdleInhibitor(std::any inhibitor) { const auto PINHIBIT = m_idleInhibitors.emplace_back(makeUnique<SIdleInhibitor>()).get(); PINHIBIT->inhibitor = std::any_cast<SP<CIdleInhibitor>>(inhibitor); - Debug::log(LOG, "New idle inhibitor registered for surface {:x}", rc<uintptr_t>(PINHIBIT->inhibitor->m_surface.get())); + Log::logger->log(Log::DEBUG, "New idle inhibitor registered for surface {:x}", rc<uintptr_t>(PINHIBIT->inhibitor->m_surface.get())); PINHIBIT->inhibitor->m_listeners.destroy = PINHIBIT->inhibitor->m_resource->m_events.destroy.listen([this, PINHIBIT] { std::erase_if(m_idleInhibitors, [PINHIBIT](const auto& other) { return other.get() == PINHIBIT; }); @@ -18,7 +18,7 @@ void CInputManager::newIdleInhibitor(std::any inhibitor) { auto WLSurface = Desktop::View::CWLSurface::fromResource(PINHIBIT->inhibitor->m_surface.lock()); if (!WLSurface) { - Debug::log(LOG, "Inhibitor has no HL Surface attached to it, likely meaning it's a non-desktop element. Assuming it's visible."); + Log::logger->log(Log::DEBUG, "Inhibitor has no HL Surface attached to it, likely meaning it's a non-desktop element. Assuming it's visible."); PINHIBIT->nonDesktop = true; recheckIdleInhibitorStatus(); return; diff --git a/src/managers/input/InputManager.cpp b/src/managers/input/InputManager.cpp index 078edc15..764c394e 100644 --- a/src/managers/input/InputManager.cpp +++ b/src/managers/input/InputManager.cpp @@ -56,7 +56,7 @@ CInputManager::CInputManager() { if (wl_resource_get_client(event.pMgr->resource()) != g_pSeatManager->m_state.pointerFocusResource->client()) return; - Debug::log(LOG, "cursorImage request: shape {} -> {}", sc<uint32_t>(event.shape), event.shapeName); + Log::logger->log(Log::DEBUG, "cursorImage request: shape {} -> {}", sc<uint32_t>(event.shape), event.shapeName); m_cursorSurfaceInfo.wlSurface->unassign(); m_cursorSurfaceInfo.vHotspot = {}; @@ -275,7 +275,8 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus, bool mouse, st return; } else - Debug::log(ERR, "BUG THIS: Null SURF/CONSTRAINT in mouse refocus. Ignoring constraints. {:x} {:x}", rc<uintptr_t>(SURF.get()), rc<uintptr_t>(CONSTRAINT.get())); + Log::logger->log(Log::ERR, "BUG THIS: Null SURF/CONSTRAINT in mouse refocus. Ignoring constraints. {:x} {:x}", rc<uintptr_t>(SURF.get()), + rc<uintptr_t>(CONSTRAINT.get())); } if (PMONITOR != Desktop::focusState()->monitor() && (*PMOUSEFOCUSMON || refocus) && m_forcedFocus.expired()) @@ -676,7 +677,7 @@ void CInputManager::onMouseButton(IPointer::SButtonEvent e) { } void CInputManager::processMouseRequest(const CSeatManager::SSetCursorEvent& event) { - Debug::log(LOG, "cursorImage request: surface {:x}", rc<uintptr_t>(event.surf.get())); + Log::logger->log(Log::DEBUG, "cursorImage request: surface {:x}", rc<uintptr_t>(event.surf.get())); if (event.surf != m_cursorSurfaceInfo.wlSurface->resource()) { m_cursorSurfaceInfo.wlSurface->unassign(); @@ -725,13 +726,13 @@ eClickBehaviorMode CInputManager::getClickMode() { void CInputManager::setClickMode(eClickBehaviorMode mode) { switch (mode) { case CLICKMODE_DEFAULT: - Debug::log(LOG, "SetClickMode: DEFAULT"); + Log::logger->log(Log::DEBUG, "SetClickMode: DEFAULT"); m_clickBehavior = CLICKMODE_DEFAULT; g_pHyprRenderer->setCursorFromName("left_ptr", true); break; case CLICKMODE_KILL: - Debug::log(LOG, "SetClickMode: KILL"); + Log::logger->log(Log::DEBUG, "SetClickMode: KILL"); m_clickBehavior = CLICKMODE_KILL; // remove constraints @@ -831,7 +832,7 @@ void CInputManager::processMouseDownKill(const IPointer::SButtonEvent& e) { g_pCompositor->vectorToWindowUnified(getMouseCoordsInternal(), Desktop::View::RESERVED_EXTENTS | Desktop::View::INPUT_EXTENTS | Desktop::View::ALLOW_FLOATING); if (!PWINDOW) { - Debug::log(ERR, "Cannot kill invalid window!"); + Log::logger->log(Log::ERR, "Cannot kill invalid window!"); break; } @@ -960,7 +961,7 @@ void CInputManager::newKeyboard(SP<IKeyboard> keeb) { setupKeyboard(PNEWKEYBOARD); - Debug::log(LOG, "New keyboard created, pointers Hypr: {:x}", rc<uintptr_t>(PNEWKEYBOARD.get())); + Log::logger->log(Log::DEBUG, "New keyboard created, pointers Hypr: {:x}", rc<uintptr_t>(PNEWKEYBOARD.get())); } void CInputManager::newKeyboard(SP<Aquamarine::IKeyboard> keyboard) { @@ -968,7 +969,7 @@ void CInputManager::newKeyboard(SP<Aquamarine::IKeyboard> keyboard) { setupKeyboard(PNEWKEYBOARD); - Debug::log(LOG, "New keyboard created, pointers Hypr: {:x} and AQ: {:x}", rc<uintptr_t>(PNEWKEYBOARD.get()), rc<uintptr_t>(keyboard.get())); + Log::logger->log(Log::DEBUG, "New keyboard created, pointers Hypr: {:x} and AQ: {:x}", rc<uintptr_t>(PNEWKEYBOARD.get()), rc<uintptr_t>(keyboard.get())); } void CInputManager::newVirtualKeyboard(SP<CVirtualKeyboardV1Resource> keyboard) { @@ -976,7 +977,7 @@ void CInputManager::newVirtualKeyboard(SP<CVirtualKeyboardV1Resource> keyboard) setupKeyboard(PNEWKEYBOARD); - Debug::log(LOG, "New virtual keyboard created at {:x}", rc<uintptr_t>(PNEWKEYBOARD.get())); + Log::logger->log(Log::DEBUG, "New virtual keyboard created at {:x}", rc<uintptr_t>(PNEWKEYBOARD.get())); } void CInputManager::setupKeyboard(SP<IKeyboard> keeb) { @@ -987,7 +988,7 @@ void CInputManager::setupKeyboard(SP<IKeyboard> keeb) { try { keeb->m_hlName = getNameForNewDevice(keeb->m_deviceName); } catch (std::exception& e) { - Debug::log(ERR, "Keyboard had no name???"); // logic error + Log::logger->log(Log::ERR, "Keyboard had no name???"); // logic error } keeb->m_events.destroy.listenStatic([this, keeb = keeb.get()] { @@ -997,7 +998,7 @@ void CInputManager::setupKeyboard(SP<IKeyboard> keeb) { return; destroyKeyboard(PKEEB); - Debug::log(LOG, "Destroyed keyboard {:x}", rc<uintptr_t>(keeb)); + Log::logger->log(Log::DEBUG, "Destroyed keyboard {:x}", rc<uintptr_t>(keeb)); }); keeb->m_keyboardEvents.key.listenStatic([this, keeb = keeb.get()](const IKeyboard::SKeyEvent& event) { @@ -1062,7 +1063,7 @@ void CInputManager::applyConfigToKeyboard(SP<IKeyboard> pKeyboard) { const auto HASCONFIG = g_pConfigManager->deviceConfigExists(devname); - Debug::log(LOG, "ApplyConfigToKeyboard for \"{}\", hasconfig: {}", devname, sc<int>(HASCONFIG)); + Log::logger->log(Log::DEBUG, "ApplyConfigToKeyboard for \"{}\", hasconfig: {}", devname, sc<int>(HASCONFIG)); const auto REPEATRATE = g_pConfigManager->getDeviceInt(devname, "repeat_rate", "input:repeat_rate"); const auto REPEATDELAY = g_pConfigManager->getDeviceInt(devname, "repeat_delay", "input:repeat_delay"); @@ -1088,11 +1089,11 @@ void CInputManager::applyConfigToKeyboard(SP<IKeyboard> pKeyboard) { if (PERM == PERMISSION_RULE_ALLOW_MODE_PENDING) { const auto PROMISE = g_pDynamicPermissionManager->promiseFor(-1, pKeyboard->m_hlName, PERMISSION_TYPE_KEYBOARD); if (!PROMISE) - Debug::log(ERR, "BUG THIS: No promise for client permission for keyboard"); + Log::logger->log(Log::ERR, "BUG THIS: No promise for client permission for keyboard"); else { PROMISE->then([k = WP<IKeyboard>{pKeyboard}](SP<CPromiseResult<eDynamicPermissionAllowMode>> r) { if (r->hasError()) { - Debug::log(ERR, "BUG THIS: No permission returned for keyboard"); + Log::logger->log(Log::ERR, "BUG THIS: No permission returned for keyboard"); return; } @@ -1109,7 +1110,7 @@ void CInputManager::applyConfigToKeyboard(SP<IKeyboard> pKeyboard) { if (NUMLOCKON == pKeyboard->m_numlockOn && REPEATDELAY == pKeyboard->m_repeatDelay && REPEATRATE == pKeyboard->m_repeatRate && RULES == pKeyboard->m_currentRules.rules && MODEL == pKeyboard->m_currentRules.model && LAYOUT == pKeyboard->m_currentRules.layout && VARIANT == pKeyboard->m_currentRules.variant && OPTIONS == pKeyboard->m_currentRules.options && FILEPATH == pKeyboard->m_xkbFilePath) { - Debug::log(LOG, "Not applying config to keyboard, it did not change."); + Log::logger->log(Log::DEBUG, "Not applying config to keyboard, it did not change."); return; } } catch (std::exception& e) { @@ -1128,8 +1129,8 @@ void CInputManager::applyConfigToKeyboard(SP<IKeyboard> pKeyboard) { g_pEventManager->postEvent(SHyprIPCEvent{"activelayout", pKeyboard->m_hlName + "," + LAYOUTSTR}); EMIT_HOOK_EVENT("activeLayout", (std::vector<std::any>{pKeyboard, LAYOUTSTR})); - Debug::log(LOG, "Set the keyboard layout to {} and variant to {} for keyboard \"{}\"", pKeyboard->m_currentRules.layout, pKeyboard->m_currentRules.variant, - pKeyboard->m_hlName); + Log::logger->log(Log::DEBUG, "Set the keyboard layout to {} and variant to {} for keyboard \"{}\"", pKeyboard->m_currentRules.layout, pKeyboard->m_currentRules.variant, + pKeyboard->m_hlName); } void CInputManager::newVirtualMouse(SP<CVirtualPointerV1Resource> mouse) { @@ -1137,7 +1138,7 @@ void CInputManager::newVirtualMouse(SP<CVirtualPointerV1Resource> mouse) { setupMouse(PMOUSE); - Debug::log(LOG, "New virtual mouse created"); + Log::logger->log(Log::DEBUG, "New virtual mouse created"); } void CInputManager::newMouse(SP<IPointer> mouse) { @@ -1145,7 +1146,7 @@ void CInputManager::newMouse(SP<IPointer> mouse) { setupMouse(mouse); - Debug::log(LOG, "New mouse created, pointer Hypr: {:x}", rc<uintptr_t>(mouse.get())); + Log::logger->log(Log::DEBUG, "New mouse created, pointer Hypr: {:x}", rc<uintptr_t>(mouse.get())); } void CInputManager::newMouse(SP<Aquamarine::IPointer> mouse) { @@ -1153,7 +1154,7 @@ void CInputManager::newMouse(SP<Aquamarine::IPointer> mouse) { setupMouse(PMOUSE); - Debug::log(LOG, "New mouse created, pointer AQ: {:x}", rc<uintptr_t>(mouse.get())); + Log::logger->log(Log::DEBUG, "New mouse created, pointer AQ: {:x}", rc<uintptr_t>(mouse.get())); } void CInputManager::setupMouse(SP<IPointer> mauz) { @@ -1162,15 +1163,15 @@ void CInputManager::setupMouse(SP<IPointer> mauz) { try { mauz->m_hlName = getNameForNewDevice(mauz->m_deviceName); } catch (std::exception& e) { - Debug::log(ERR, "Mouse had no name???"); // logic error + Log::logger->log(Log::ERR, "Mouse had no name???"); // logic error } if (mauz->aq() && mauz->aq()->getLibinputHandle()) { const auto LIBINPUTDEV = mauz->aq()->getLibinputHandle(); - Debug::log(LOG, "New mouse has libinput sens {:.2f} ({:.2f}) with accel profile {} ({})", libinput_device_config_accel_get_speed(LIBINPUTDEV), - libinput_device_config_accel_get_default_speed(LIBINPUTDEV), sc<int>(libinput_device_config_accel_get_profile(LIBINPUTDEV)), - sc<int>(libinput_device_config_accel_get_default_profile(LIBINPUTDEV))); + Log::logger->log(Log::DEBUG, "New mouse has libinput sens {:.2f} ({:.2f}) with accel profile {} ({})", libinput_device_config_accel_get_speed(LIBINPUTDEV), + libinput_device_config_accel_get_default_speed(LIBINPUTDEV), sc<int>(libinput_device_config_accel_get_profile(LIBINPUTDEV)), + sc<int>(libinput_device_config_accel_get_default_profile(LIBINPUTDEV))); } g_pPointerManager->attachPointer(mauz); @@ -1237,7 +1238,7 @@ void CInputManager::setPointerConfigs() { else if (TAP_MAP == "lmr") libinput_device_config_tap_set_button_map(LIBINPUTDEV, LIBINPUT_CONFIG_TAP_MAP_LMR); else - Debug::log(WARN, "Tap button mapping unknown"); + Log::logger->log(Log::WARN, "Tap button mapping unknown"); } const auto SCROLLMETHOD = g_pConfigManager->getDeviceString(devname, "scroll_method", "input:scroll_method"); @@ -1252,7 +1253,7 @@ void CInputManager::setPointerConfigs() { } else if (SCROLLMETHOD == "on_button_down") { libinput_device_config_scroll_set_method(LIBINPUTDEV, LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN); } else { - Debug::log(WARN, "Scroll method unknown"); + Log::logger->log(Log::WARN, "Scroll method unknown"); } if (g_pConfigManager->getDeviceInt(devname, "tap-and-drag", "input:touchpad:tap-and-drag") == 0) @@ -1331,15 +1332,15 @@ void CInputManager::setPointerConfigs() { } libinput_config_accel_set_points(CONFIG, LIBINPUT_ACCEL_TYPE_SCROLL, scrollStep, scrollPoints.size(), scrollPoints.data()); - } catch (std::exception& e) { Debug::log(ERR, "Invalid values in scroll_points"); } + } catch (std::exception& e) { Log::logger->log(Log::ERR, "Invalid values in scroll_points"); } } libinput_config_accel_set_points(CONFIG, LIBINPUT_ACCEL_TYPE_MOTION, accelStep, accelPoints.size(), accelPoints.data()); libinput_device_config_accel_apply(LIBINPUTDEV, CONFIG); libinput_config_accel_destroy(CONFIG); - } catch (std::exception& e) { Debug::log(ERR, "Invalid values in custom accel profile"); } + } catch (std::exception& e) { Log::logger->log(Log::ERR, "Invalid values in custom accel profile"); } } else { - Debug::log(WARN, "Unknown acceleration profile, falling back to default"); + Log::logger->log(Log::WARN, "Unknown acceleration profile, falling back to default"); } const auto SCROLLBUTTON = g_pConfigManager->getDeviceInt(devname, "scroll_button", "input:scroll_button"); @@ -1351,7 +1352,7 @@ void CInputManager::setPointerConfigs() { libinput_device_config_scroll_set_button_lock(LIBINPUTDEV, SCROLLBUTTONLOCK == 0 ? LIBINPUT_CONFIG_SCROLL_BUTTON_LOCK_DISABLED : LIBINPUT_CONFIG_SCROLL_BUTTON_LOCK_ENABLED); - Debug::log(LOG, "Applied config to mouse {}, sens {:.2f}", m->m_hlName, LIBINPUTSENS); + Log::logger->log(Log::DEBUG, "Applied config to mouse {}, sens {:.2f}", m->m_hlName, LIBINPUTSENS); } } } @@ -1362,7 +1363,7 @@ static void removeFromHIDs(WP<IHID> hid) { } void CInputManager::destroyKeyboard(SP<IKeyboard> pKeyboard) { - Debug::log(LOG, "Keyboard at {:x} removed", rc<uintptr_t>(pKeyboard.get())); + Log::logger->log(Log::DEBUG, "Keyboard at {:x} removed", rc<uintptr_t>(pKeyboard.get())); std::erase_if(m_keyboards, [pKeyboard](const auto& other) { return other == pKeyboard; }); @@ -1386,7 +1387,7 @@ void CInputManager::destroyKeyboard(SP<IKeyboard> pKeyboard) { } void CInputManager::destroyPointer(SP<IPointer> mouse) { - Debug::log(LOG, "Pointer at {:x} removed", rc<uintptr_t>(mouse.get())); + Log::logger->log(Log::DEBUG, "Pointer at {:x} removed", rc<uintptr_t>(mouse.get())); std::erase_if(m_pointers, [mouse](const auto& other) { return other == mouse; }); @@ -1399,7 +1400,7 @@ void CInputManager::destroyPointer(SP<IPointer> mouse) { } void CInputManager::destroyTouchDevice(SP<ITouch> touch) { - Debug::log(LOG, "Touch device at {:x} removed", rc<uintptr_t>(touch.get())); + Log::logger->log(Log::DEBUG, "Touch device at {:x} removed", rc<uintptr_t>(touch.get())); std::erase_if(m_touches, [touch](const auto& other) { return other == touch; }); @@ -1407,7 +1408,7 @@ void CInputManager::destroyTouchDevice(SP<ITouch> touch) { } void CInputManager::destroyTablet(SP<CTablet> tablet) { - Debug::log(LOG, "Tablet device at {:x} removed", rc<uintptr_t>(tablet.get())); + Log::logger->log(Log::DEBUG, "Tablet device at {:x} removed", rc<uintptr_t>(tablet.get())); std::erase_if(m_tablets, [tablet](const auto& other) { return other == tablet; }); @@ -1415,7 +1416,7 @@ void CInputManager::destroyTablet(SP<CTablet> tablet) { } void CInputManager::destroyTabletTool(SP<CTabletTool> tool) { - Debug::log(LOG, "Tablet tool at {:x} removed", rc<uintptr_t>(tool.get())); + Log::logger->log(Log::DEBUG, "Tablet tool at {:x} removed", rc<uintptr_t>(tool.get())); std::erase_if(m_tabletTools, [tool](const auto& other) { return other == tool; }); @@ -1423,7 +1424,7 @@ void CInputManager::destroyTabletTool(SP<CTabletTool> tool) { } void CInputManager::destroyTabletPad(SP<CTabletPad> pad) { - Debug::log(LOG, "Tablet pad at {:x} removed", rc<uintptr_t>(pad.get())); + Log::logger->log(Log::DEBUG, "Tablet pad at {:x} removed", rc<uintptr_t>(pad.get())); std::erase_if(m_tabletPads, [pad](const auto& other) { return other == pad; }); @@ -1541,7 +1542,7 @@ void CInputManager::onKeyboardMod(SP<IKeyboard> pKeyboard) { const auto LAYOUT = pKeyboard->getActiveLayout(); - Debug::log(LOG, "LAYOUT CHANGED TO {} GROUP {}", LAYOUT, MODS.group); + Log::logger->log(Log::DEBUG, "LAYOUT CHANGED TO {} GROUP {}", LAYOUT, MODS.group); g_pEventManager->postEvent(SHyprIPCEvent{"activelayout", pKeyboard->m_hlName + "," + LAYOUT}); EMIT_HOOK_EVENT("activeLayout", (std::vector<std::any>{pKeyboard, LAYOUT})); @@ -1571,7 +1572,7 @@ void CInputManager::refocus(std::optional<Vector2D> overridePos) { bool CInputManager::refocusLastWindow(PHLMONITOR pMonitor) { if (!m_exclusiveLSes.empty()) { - Debug::log(LOG, "CInputManager::refocusLastWindow: ignoring, exclusive LS present."); + Log::logger->log(Log::DEBUG, "CInputManager::refocusLastWindow: ignoring, exclusive LS present."); return false; } @@ -1735,7 +1736,7 @@ void CInputManager::newTouchDevice(SP<Aquamarine::ITouch> pDevice) { try { PNEWDEV->m_hlName = getNameForNewDevice(PNEWDEV->m_deviceName); } catch (std::exception& e) { - Debug::log(ERR, "Touch Device had no name???"); // logic error + Log::logger->log(Log::ERR, "Touch Device had no name???"); // logic error } setTouchDeviceConfigs(PNEWDEV); @@ -1750,7 +1751,7 @@ void CInputManager::newTouchDevice(SP<Aquamarine::ITouch> pDevice) { destroyTouchDevice(PDEV); }); - Debug::log(LOG, "New touch device added at {:x}", rc<uintptr_t>(PNEWDEV.get())); + Log::logger->log(Log::DEBUG, "New touch device added at {:x}", rc<uintptr_t>(PNEWDEV.get())); } void CInputManager::setTouchDeviceConfigs(SP<ITouch> dev) { @@ -1764,7 +1765,7 @@ void CInputManager::setTouchDeviceConfigs(SP<ITouch> dev) { libinput_device_config_send_events_set_mode(LIBINPUTDEV, mode); if (libinput_device_config_calibration_has_matrix(LIBINPUTDEV)) { - Debug::log(LOG, "Setting calibration matrix for device {}", PTOUCHDEV->m_hlName); + Log::logger->log(Log::DEBUG, "Setting calibration matrix for device {}", PTOUCHDEV->m_hlName); // default value of transform being -1 means it's unset. const int ROTATION = std::clamp(g_pConfigManager->getDeviceInt(PTOUCHDEV->m_hlName, "transform", "input:touchdevice:transform"), -1, 7); if (ROTATION > -1) @@ -1785,10 +1786,10 @@ void CInputManager::setTouchDeviceConfigs(SP<ITouch> dev) { PTOUCHDEV->m_boundOutput = bound ? output : ""; const auto PMONITOR = bound ? g_pCompositor->getMonitorFromName(output) : nullptr; if (PMONITOR) { - Debug::log(LOG, "Binding touch device {} to output {}", PTOUCHDEV->m_hlName, PMONITOR->m_name); + Log::logger->log(Log::DEBUG, "Binding touch device {} to output {}", PTOUCHDEV->m_hlName, PMONITOR->m_name); // wlr_cursor_map_input_to_output(g_pCompositor->m_sWLRCursor, &PTOUCHDEV->wlr()->base, PMONITOR->output); } else if (bound) - Debug::log(ERR, "Failed to bind touch device {} to output '{}': monitor not found", PTOUCHDEV->m_hlName, output); + Log::logger->log(Log::ERR, "Failed to bind touch device {} to output '{}': monitor not found", PTOUCHDEV->m_hlName, output); } }; @@ -1812,7 +1813,7 @@ void CInputManager::setTabletConfigs() { t->m_relativeInput = RELINPUT; const int ROTATION = std::clamp(g_pConfigManager->getDeviceInt(NAME, "transform", "input:tablet:transform"), -1, 7); - Debug::log(LOG, "Setting calibration matrix for device {}", NAME); + Log::logger->log(Log::DEBUG, "Setting calibration matrix for device {}", NAME); if (ROTATION > -1) libinput_device_config_calibration_set_matrix(LIBINPUTDEV, MATRICES[ROTATION]); @@ -1823,7 +1824,7 @@ void CInputManager::setTabletConfigs() { const auto OUTPUT = g_pConfigManager->getDeviceString(NAME, "output", "input:tablet:output"); if (OUTPUT != STRVAL_EMPTY) { - Debug::log(LOG, "Binding tablet {} to output {}", NAME, OUTPUT); + Log::logger->log(Log::DEBUG, "Binding tablet {} to output {}", NAME, OUTPUT); t->m_boundOutput = OUTPUT; } else t->m_boundOutput = ""; @@ -1854,22 +1855,22 @@ void CInputManager::newSwitch(SP<Aquamarine::ISwitch> pDevice) { const auto PNEWDEV = &m_switches.emplace_back(); PNEWDEV->pDevice = pDevice; - Debug::log(LOG, "New switch with name \"{}\" added", pDevice->getName()); + Log::logger->log(Log::DEBUG, "New switch with name \"{}\" added", pDevice->getName()); PNEWDEV->listeners.destroy = pDevice->events.destroy.listen([this, PNEWDEV] { destroySwitch(PNEWDEV); }); PNEWDEV->listeners.fire = pDevice->events.fire.listen([PNEWDEV](const Aquamarine::ISwitch::SFireEvent& event) { const auto NAME = PNEWDEV->pDevice->getName(); - Debug::log(LOG, "Switch {} fired, triggering binds.", NAME); + Log::logger->log(Log::DEBUG, "Switch {} fired, triggering binds.", NAME); g_pKeybindManager->onSwitchEvent(NAME); if (event.enable) { - Debug::log(LOG, "Switch {} turn on, triggering binds.", NAME); + Log::logger->log(Log::DEBUG, "Switch {} turn on, triggering binds.", NAME); g_pKeybindManager->onSwitchOnEvent(NAME); } else { - Debug::log(LOG, "Switch {} turn off, triggering binds.", NAME); + Log::logger->log(Log::DEBUG, "Switch {} turn off, triggering binds.", NAME); g_pKeybindManager->onSwitchOffEvent(NAME); } }); diff --git a/src/managers/input/InputMethodPopup.cpp b/src/managers/input/InputMethodPopup.cpp index 41a1ccad..9a891213 100644 --- a/src/managers/input/InputMethodPopup.cpp +++ b/src/managers/input/InputMethodPopup.cpp @@ -30,7 +30,7 @@ void CInputPopup::onDestroy() { } void CInputPopup::onMap() { - Debug::log(LOG, "Mapped an IME Popup"); + Log::logger->log(Log::DEBUG, "Mapped an IME Popup"); updateBox(); damageEntire(); @@ -44,7 +44,7 @@ void CInputPopup::onMap() { } void CInputPopup::onUnmap() { - Debug::log(LOG, "Unmapped an IME Popup"); + Log::logger->log(Log::DEBUG, "Unmapped an IME Popup"); damageEntire(); } @@ -57,7 +57,7 @@ void CInputPopup::damageEntire() { const auto OWNER = queryOwner(); if (!OWNER) { - Debug::log(ERR, "BUG THIS: No owner in imepopup::damageentire"); + Log::logger->log(Log::ERR, "BUG THIS: No owner in imepopup::damageentire"); return; } CBox box = globalBox(); @@ -68,7 +68,7 @@ void CInputPopup::damageSurface() { const auto OWNER = queryOwner(); if (!OWNER) { - Debug::log(ERR, "BUG THIS: No owner in imepopup::damagesurface"); + Log::logger->log(Log::ERR, "BUG THIS: No owner in imepopup::damagesurface"); return; } @@ -150,7 +150,7 @@ CBox CInputPopup::globalBox() { const auto OWNER = queryOwner(); if (!OWNER) { - Debug::log(ERR, "BUG THIS: No owner in imepopup::globalbox"); + Log::logger->log(Log::ERR, "BUG THIS: No owner in imepopup::globalbox"); return {}; } CBox parentBox = OWNER->getSurfaceBoxGlobal().value_or(CBox{0, 0, 500, 500}); diff --git a/src/managers/input/InputMethodRelay.cpp b/src/managers/input/InputMethodRelay.cpp index 0b434410..15dd249e 100644 --- a/src/managers/input/InputMethodRelay.cpp +++ b/src/managers/input/InputMethodRelay.cpp @@ -17,7 +17,7 @@ CInputMethodRelay::CInputMethodRelay() { void CInputMethodRelay::onNewIME(SP<CInputMethodV2> pIME) { if (!m_inputMethod.expired()) { - Debug::log(ERR, "Cannot register 2 IMEs at once!"); + Log::logger->log(Log::ERR, "Cannot register 2 IMEs at once!"); pIME->unavailable(); @@ -30,7 +30,7 @@ void CInputMethodRelay::onNewIME(SP<CInputMethodV2> pIME) { const auto PTI = getFocusedTextInput(); if (!PTI) { - Debug::log(LOG, "No focused TextInput on IME Commit"); + Log::logger->log(Log::DEBUG, "No focused TextInput on IME Commit"); return; } @@ -40,7 +40,7 @@ void CInputMethodRelay::onNewIME(SP<CInputMethodV2> pIME) { m_listeners.destroyIME = pIME->m_events.destroy.listen([this] { const auto PTI = getFocusedTextInput(); - Debug::log(LOG, "IME Destroy"); + Log::logger->log(Log::DEBUG, "IME Destroy"); if (PTI) PTI->leave(); @@ -50,7 +50,7 @@ void CInputMethodRelay::onNewIME(SP<CInputMethodV2> pIME) { m_listeners.newPopup = pIME->m_events.newPopup.listen([this](const SP<CInputMethodPopupV2>& popup) { m_inputMethodPopups.emplace_back(makeUnique<CInputPopup>(popup)); - Debug::log(LOG, "New input popup"); + Log::logger->log(Log::DEBUG, "New input popup"); }); if (!Desktop::focusState()->surface()) diff --git a/src/managers/input/Tablets.cpp b/src/managers/input/Tablets.cpp index 058d6ac1..5bb0bb50 100644 --- a/src/managers/input/Tablets.cpp +++ b/src/managers/input/Tablets.cpp @@ -231,7 +231,7 @@ void CInputManager::newTablet(SP<Aquamarine::ITablet> pDevice) { try { PNEWTABLET->m_hlName = g_pInputManager->getNameForNewDevice(pDevice->getName()); } catch (std::exception& e) { - Debug::log(ERR, "Tablet had no name???"); // logic error + Log::logger->log(Log::ERR, "Tablet had no name???"); // logic error } g_pPointerManager->attachTablet(PNEWTABLET); @@ -257,7 +257,7 @@ SP<CTabletTool> CInputManager::ensureTabletToolPresent(SP<Aquamarine::ITabletToo try { PTOOL->m_hlName = g_pInputManager->getNameForNewDevice(pTool->getName()); } catch (std::exception& e) { - Debug::log(ERR, "Tablet had no name???"); // logic error + Log::logger->log(Log::ERR, "Tablet had no name???"); // logic error } PTOOL->m_events.destroy.listenStatic([this, tool = PTOOL.get()] { @@ -275,7 +275,7 @@ void CInputManager::newTabletPad(SP<Aquamarine::ITabletPad> pDevice) { try { PNEWPAD->m_hlName = g_pInputManager->getNameForNewDevice(pDevice->getName()); } catch (std::exception& e) { - Debug::log(ERR, "Pad had no name???"); // logic error + Log::logger->log(Log::ERR, "Pad had no name???"); // logic error } PNEWPAD->m_events.destroy.listenStatic([this, pad = PNEWPAD.get()] { diff --git a/src/managers/input/TextInput.cpp b/src/managers/input/TextInput.cpp index a2b37bb6..4475b5ee 100644 --- a/src/managers/input/TextInput.cpp +++ b/src/managers/input/TextInput.cpp @@ -50,10 +50,10 @@ void CTextInput::initCallbacks() { } void CTextInput::onEnabled(SP<CWLSurfaceResource> surfV1) { - Debug::log(LOG, "TI ENABLE"); + Log::logger->log(Log::DEBUG, "TI ENABLE"); if (g_pInputManager->m_relay.m_inputMethod.expired()) { - // Debug::log(WARN, "Enabling TextInput on no IME!"); + // Log::logger->log(Log::WARN, "Enabling TextInput on no IME!"); return; } @@ -70,7 +70,7 @@ void CTextInput::onEnabled(SP<CWLSurfaceResource> surfV1) { void CTextInput::onDisabled() { if (g_pInputManager->m_relay.m_inputMethod.expired()) { - // Debug::log(WARN, "Disabling TextInput on no IME!"); + // Log::logger->log(Log::WARN, "Disabling TextInput on no IME!"); return; } @@ -107,12 +107,12 @@ void CTextInput::onReset() { void CTextInput::onCommit() { if (g_pInputManager->m_relay.m_inputMethod.expired()) { - // Debug::log(WARN, "Committing TextInput on no IME!"); + // Log::logger->log(Log::WARN, "Committing TextInput on no IME!"); return; } if (!(isV3() ? m_v3Input->m_current.enabled.value : m_v1Input->m_active)) { - Debug::log(WARN, "Disabled TextInput commit?"); + Log::logger->log(Log::WARN, "Disabled TextInput commit?"); return; } @@ -132,7 +132,7 @@ void CTextInput::setFocusedSurface(SP<CWLSurfaceResource> pSurface) { m_listeners.surfaceDestroy.reset(); m_listeners.surfaceUnmap = pSurface->m_events.unmap.listen([this] { - Debug::log(LOG, "Unmap TI owner1"); + Log::logger->log(Log::DEBUG, "Unmap TI owner1"); if (m_enterLocks) m_enterLocks--; @@ -152,7 +152,7 @@ void CTextInput::setFocusedSurface(SP<CWLSurfaceResource> pSurface) { }); m_listeners.surfaceDestroy = pSurface->m_events.destroy.listen([this] { - Debug::log(LOG, "Destroy TI owner1"); + Log::logger->log(Log::DEBUG, "Destroy TI owner1"); if (m_enterLocks) m_enterLocks--; @@ -188,7 +188,7 @@ void CTextInput::enter(SP<CWLSurfaceResource> pSurface) { m_enterLocks++; if (m_enterLocks != 1) { - Debug::log(ERR, "BUG THIS: TextInput has != 1 locks in enter"); + Log::logger->log(Log::ERR, "BUG THIS: TextInput has != 1 locks in enter"); leave(); m_enterLocks = 1; } @@ -208,7 +208,7 @@ void CTextInput::leave() { m_enterLocks--; if (m_enterLocks != 0) { - Debug::log(ERR, "BUG THIS: TextInput has != 0 locks in leave"); + Log::logger->log(Log::ERR, "BUG THIS: TextInput has != 0 locks in leave"); m_enterLocks = 0; } diff --git a/src/managers/input/Touch.cpp b/src/managers/input/Touch.cpp index 196300a2..6136cb3f 100644 --- a/src/managers/input/Touch.cpp +++ b/src/managers/input/Touch.cpp @@ -9,7 +9,7 @@ #include "../../devices/ITouch.hpp" #include "../SeatManager.hpp" #include "../HookSystemManager.hpp" -#include "debug/Log.hpp" +#include "debug/log/Logger.hpp" #include "UnifiedWorkspaceSwipeGesture.hpp" void CInputManager::onTouchDown(ITouch::SDownEvent e) { @@ -66,7 +66,7 @@ void CInputManager::onTouchDown(ITouch::SDownEvent e) { if (g_pSessionLockManager->isSessionLocked() && m_foundLSToFocus.expired()) { m_touchData.touchFocusLockSurface = g_pSessionLockManager->getSessionLockSurfaceForMonitor(PMONITOR->m_id); if (!m_touchData.touchFocusLockSurface) - Debug::log(WARN, "The session is locked but can't find a lock surface"); + Log::logger->log(Log::WARN, "The session is locked but can't find a lock surface"); else m_touchData.touchFocusSurface = m_touchData.touchFocusLockSurface->surface->surface(); } else { diff --git a/src/managers/input/UnifiedWorkspaceSwipeGesture.cpp b/src/managers/input/UnifiedWorkspaceSwipeGesture.cpp index 68ee5b9b..c952c0c8 100644 --- a/src/managers/input/UnifiedWorkspaceSwipeGesture.cpp +++ b/src/managers/input/UnifiedWorkspaceSwipeGesture.cpp @@ -15,7 +15,7 @@ void CUnifiedWorkspaceSwipeGesture::begin() { const auto PWORKSPACE = Desktop::focusState()->monitor()->m_activeWorkspace; - Debug::log(LOG, "CUnifiedWorkspaceSwipeGesture::begin: Starting a swipe from {}", PWORKSPACE->m_name); + Log::logger->log(Log::DEBUG, "CUnifiedWorkspaceSwipeGesture::begin: Starting a swipe from {}", PWORKSPACE->m_name); m_workspaceBegin = PWORKSPACE; m_delta = 0; @@ -261,7 +261,7 @@ void CUnifiedWorkspaceSwipeGesture::end() { g_pInputManager->unconstrainMouse(); - Debug::log(LOG, "Ended swipe to the left"); + Log::logger->log(Log::DEBUG, "Ended swipe to the left"); pSwitchedTo = PWORKSPACEL; } else { @@ -288,7 +288,7 @@ void CUnifiedWorkspaceSwipeGesture::end() { g_pInputManager->unconstrainMouse(); - Debug::log(LOG, "Ended swipe to the right"); + Log::logger->log(Log::DEBUG, "Ended swipe to the right"); pSwitchedTo = PWORKSPACER; } diff --git a/src/managers/input/trackpad/TrackpadGestures.cpp b/src/managers/input/trackpad/TrackpadGestures.cpp index 3595f5ba..d41b8ede 100644 --- a/src/managers/input/trackpad/TrackpadGestures.cpp +++ b/src/managers/input/trackpad/TrackpadGestures.cpp @@ -103,7 +103,7 @@ std::expected<void, std::string> CTrackpadGestures::removeGesture(size_t fingerC void CTrackpadGestures::gestureBegin(const IPointer::SSwipeBeginEvent& e) { if (m_activeGesture) { - Debug::log(ERR, "CTrackpadGestures::gestureBegin (swipe) but m_activeGesture is already present"); + Log::logger->log(Log::ERR, "CTrackpadGestures::gestureBegin (swipe) but m_activeGesture is already present"); return; } @@ -121,7 +121,7 @@ void CTrackpadGestures::gestureUpdate(const IPointer::SSwipeUpdateEvent& e) { // 5 was chosen because I felt like that's a good number. if (!m_activeGesture && (std::abs(m_currentTotalDelta.x) < 5 && std::abs(m_currentTotalDelta.y) < 5)) { - Debug::log(TRACE, "CTrackpadGestures::gestureUpdate (swipe): gesture delta too small to start considering, waiting"); + Log::logger->log(Log::TRACE, "CTrackpadGestures::gestureUpdate (swipe): gesture delta too small to start considering, waiting"); return; } @@ -174,7 +174,7 @@ void CTrackpadGestures::gestureEnd(const IPointer::SSwipeEndEvent& e) { void CTrackpadGestures::gestureBegin(const IPointer::SPinchBeginEvent& e) { if (m_activeGesture) { - Debug::log(ERR, "CTrackpadGestures::gestureBegin (pinch) but m_activeGesture is already present"); + Log::logger->log(Log::ERR, "CTrackpadGestures::gestureBegin (pinch) but m_activeGesture is already present"); return; } @@ -189,7 +189,7 @@ void CTrackpadGestures::gestureUpdate(const IPointer::SPinchUpdateEvent& e) { // 0.1 was chosen because I felt like that's a good number. if (!m_activeGesture && std::abs(e.scale - 1.F) < 0.1) { - Debug::log(TRACE, "CTrackpadGestures::gestureUpdate (pinch): gesture delta too small to start considering, waiting"); + Log::logger->log(Log::TRACE, "CTrackpadGestures::gestureUpdate (pinch): gesture delta too small to start considering, waiting"); return; } diff --git a/src/managers/permissions/DynamicPermissionManager.cpp b/src/managers/permissions/DynamicPermissionManager.cpp index a5484773..0e92ed8e 100644 --- a/src/managers/permissions/DynamicPermissionManager.cpp +++ b/src/managers/permissions/DynamicPermissionManager.cpp @@ -82,19 +82,19 @@ eDynamicPermissionAllowMode CDynamicPermissionManager::clientPermissionMode(wl_c const auto LOOKUP = binaryNameForWlClient(client); - Debug::log(TRACE, "CDynamicPermissionManager::clientHasPermission: checking permission {} for client {:x} (binary {})", permissionToString(permission), rc<uintptr_t>(client), - LOOKUP.has_value() ? LOOKUP.value() : "lookup failed: " + LOOKUP.error()); + Log::logger->log(Log::TRACE, "CDynamicPermissionManager::clientHasPermission: checking permission {} for client {:x} (binary {})", permissionToString(permission), + rc<uintptr_t>(client), LOOKUP.has_value() ? LOOKUP.value() : "lookup failed: " + LOOKUP.error()); // first, check if we have the client + perm combo in our cache. auto it = std::ranges::find_if(m_rules, [client, permission](const auto& e) { return e->m_client == client && e->m_type == permission; }); if (it == m_rules.end()) { - Debug::log(TRACE, "CDynamicPermissionManager::clientHasPermission: permission not cached, checking binary name"); + Log::logger->log(Log::TRACE, "CDynamicPermissionManager::clientHasPermission: permission not cached, checking binary name"); if (!LOOKUP.has_value()) - Debug::log(TRACE, "CDynamicPermissionManager::clientHasPermission: binary name check failed"); + Log::logger->log(Log::TRACE, "CDynamicPermissionManager::clientHasPermission: binary name check failed"); else { const auto BINNAME = LOOKUP.value().contains("/") ? LOOKUP.value().substr(LOOKUP.value().find_last_of('/') + 1) : LOOKUP.value(); - Debug::log(TRACE, "CDynamicPermissionManager::clientHasPermission: binary path {}, name {}", LOOKUP.value(), BINNAME); + Log::logger->log(Log::TRACE, "CDynamicPermissionManager::clientHasPermission: binary path {}, name {}", LOOKUP.value(), BINNAME); it = std::ranges::find_if(m_rules, [clientBinaryPath = LOOKUP.value(), permission](const auto& e) { if (e->m_type != permission) @@ -114,29 +114,29 @@ eDynamicPermissionAllowMode CDynamicPermissionManager::clientPermissionMode(wl_c }); if (it == m_rules.end()) - Debug::log(TRACE, "CDynamicPermissionManager::clientHasPermission: no rule for binary"); + Log::logger->log(Log::TRACE, "CDynamicPermissionManager::clientHasPermission: no rule for binary"); else { if ((*it)->m_allowMode == PERMISSION_RULE_ALLOW_MODE_ALLOW) { - Debug::log(TRACE, "CDynamicPermissionManager::clientHasPermission: permission allowed by config rule"); + Log::logger->log(Log::TRACE, "CDynamicPermissionManager::clientHasPermission: permission allowed by config rule"); return PERMISSION_RULE_ALLOW_MODE_ALLOW; } else if ((*it)->m_allowMode == PERMISSION_RULE_ALLOW_MODE_DENY) { - Debug::log(TRACE, "CDynamicPermissionManager::clientHasPermission: permission denied by config rule"); + Log::logger->log(Log::TRACE, "CDynamicPermissionManager::clientHasPermission: permission denied by config rule"); return PERMISSION_RULE_ALLOW_MODE_DENY; } else if ((*it)->m_allowMode == PERMISSION_RULE_ALLOW_MODE_PENDING) { - Debug::log(TRACE, "CDynamicPermissionManager::clientHasPermission: permission pending by config rule"); + Log::logger->log(Log::TRACE, "CDynamicPermissionManager::clientHasPermission: permission pending by config rule"); return PERMISSION_RULE_ALLOW_MODE_PENDING; } else - Debug::log(TRACE, "CDynamicPermissionManager::clientHasPermission: permission ask by config rule"); + Log::logger->log(Log::TRACE, "CDynamicPermissionManager::clientHasPermission: permission ask by config rule"); } } } else if ((*it)->m_allowMode == PERMISSION_RULE_ALLOW_MODE_ALLOW) { - Debug::log(TRACE, "CDynamicPermissionManager::clientHasPermission: permission allowed before by user"); + Log::logger->log(Log::TRACE, "CDynamicPermissionManager::clientHasPermission: permission allowed before by user"); return PERMISSION_RULE_ALLOW_MODE_ALLOW; } else if ((*it)->m_allowMode == PERMISSION_RULE_ALLOW_MODE_DENY) { - Debug::log(TRACE, "CDynamicPermissionManager::clientHasPermission: permission denied before by user"); + Log::logger->log(Log::TRACE, "CDynamicPermissionManager::clientHasPermission: permission denied before by user"); return PERMISSION_RULE_ALLOW_MODE_DENY; } else if ((*it)->m_allowMode == PERMISSION_RULE_ALLOW_MODE_PENDING) { - Debug::log(TRACE, "CDynamicPermissionManager::clientHasPermission: permission pending before by user"); + Log::logger->log(Log::TRACE, "CDynamicPermissionManager::clientHasPermission: permission pending before by user"); return PERMISSION_RULE_ALLOW_MODE_PENDING; } @@ -158,8 +158,8 @@ eDynamicPermissionAllowMode CDynamicPermissionManager::clientPermissionModeWithS if (pid > 0) { lookup = binaryNameForPid(pid); - Debug::log(TRACE, "CDynamicPermissionManager::clientHasPermission: checking permission {} for key {} (binary {})", permissionToString(permission), str, - lookup.has_value() ? lookup.value() : "lookup failed: " + lookup.error()); + Log::logger->log(Log::TRACE, "CDynamicPermissionManager::clientHasPermission: checking permission {} for key {} (binary {})", permissionToString(permission), str, + lookup.has_value() ? lookup.value() : "lookup failed: " + lookup.error()); if (lookup.has_value()) binaryName = *lookup; @@ -169,7 +169,7 @@ eDynamicPermissionAllowMode CDynamicPermissionManager::clientPermissionModeWithS // first, check if we have the client + perm combo in our cache. auto it = std::ranges::find_if(m_rules, [str, permission, pid](const auto& e) { return e->m_keyString == str && pid && pid == e->m_pid && e->m_type == permission; }); if (it == m_rules.end()) { - Debug::log(TRACE, "CDynamicPermissionManager::clientHasPermission: permission not cached, checking key"); + Log::logger->log(Log::TRACE, "CDynamicPermissionManager::clientHasPermission: permission not cached, checking key"); it = std::ranges::find_if(m_rules, [key = str, permission, &lookup](const auto& e) { if (e->m_type != permission) @@ -186,33 +186,33 @@ eDynamicPermissionAllowMode CDynamicPermissionManager::clientPermissionModeWithS }); if (it == m_rules.end()) - Debug::log(TRACE, "CDynamicPermissionManager::clientHasPermission: no rule for key"); + Log::logger->log(Log::TRACE, "CDynamicPermissionManager::clientHasPermission: no rule for key"); else { if ((*it)->m_allowMode == PERMISSION_RULE_ALLOW_MODE_ALLOW) { - Debug::log(TRACE, "CDynamicPermissionManager::clientHasPermission: permission allowed by config rule"); + Log::logger->log(Log::TRACE, "CDynamicPermissionManager::clientHasPermission: permission allowed by config rule"); return PERMISSION_RULE_ALLOW_MODE_ALLOW; } else if ((*it)->m_allowMode == PERMISSION_RULE_ALLOW_MODE_DENY) { - Debug::log(TRACE, "CDynamicPermissionManager::clientHasPermission: permission denied by config rule"); + Log::logger->log(Log::TRACE, "CDynamicPermissionManager::clientHasPermission: permission denied by config rule"); return PERMISSION_RULE_ALLOW_MODE_DENY; } else if ((*it)->m_allowMode == PERMISSION_RULE_ALLOW_MODE_PENDING) { - Debug::log(TRACE, "CDynamicPermissionManager::clientHasPermission: permission pending by config rule"); + Log::logger->log(Log::TRACE, "CDynamicPermissionManager::clientHasPermission: permission pending by config rule"); return PERMISSION_RULE_ALLOW_MODE_PENDING; } else if ((*it)->m_allowMode == PERMISSION_RULE_ALLOW_MODE_ASK) { - Debug::log(TRACE, "CDynamicPermissionManager::clientHasPermission: permission ask by config rule"); + Log::logger->log(Log::TRACE, "CDynamicPermissionManager::clientHasPermission: permission ask by config rule"); askForPermission(nullptr, str, permission, pid); return PERMISSION_RULE_ALLOW_MODE_PENDING; } else - Debug::log(TRACE, "CDynamicPermissionManager::clientHasPermission: permission ask by config rule"); + Log::logger->log(Log::TRACE, "CDynamicPermissionManager::clientHasPermission: permission ask by config rule"); } } else if ((*it)->m_allowMode == PERMISSION_RULE_ALLOW_MODE_ALLOW) { - Debug::log(TRACE, "CDynamicPermissionManager::clientHasPermission: permission allowed before by user"); + Log::logger->log(Log::TRACE, "CDynamicPermissionManager::clientHasPermission: permission allowed before by user"); return PERMISSION_RULE_ALLOW_MODE_ALLOW; } else if ((*it)->m_allowMode == PERMISSION_RULE_ALLOW_MODE_DENY) { - Debug::log(TRACE, "CDynamicPermissionManager::clientHasPermission: permission denied before by user"); + Log::logger->log(Log::TRACE, "CDynamicPermissionManager::clientHasPermission: permission denied before by user"); return PERMISSION_RULE_ALLOW_MODE_DENY; } else if ((*it)->m_allowMode == PERMISSION_RULE_ALLOW_MODE_PENDING) { - Debug::log(TRACE, "CDynamicPermissionManager::clientHasPermission: permission pending before by user"); + Log::logger->log(Log::TRACE, "CDynamicPermissionManager::clientHasPermission: permission pending before by user"); return PERMISSION_RULE_ALLOW_MODE_PENDING; } @@ -272,7 +272,7 @@ void CDynamicPermissionManager::askForPermission(wl_client* client, const std::s rule->m_dialogBox->m_priority = true; if (!rule->m_dialogBox) { - Debug::log(ERR, "CDynamicPermissionManager::askForPermission: hyprland-guiutils likely missing, cannot ask! Disabling permission control..."); + Log::logger->log(Log::ERR, "CDynamicPermissionManager::askForPermission: hyprland-guiutils likely missing, cannot ask! Disabling permission control..."); rule->m_allowMode = PERMISSION_RULE_ALLOW_MODE_ALLOW; return; } @@ -284,7 +284,7 @@ void CDynamicPermissionManager::askForPermission(wl_client* client, const std::s if (pr->hasError()) { // not reachable for now - Debug::log(TRACE, "CDynamicPermissionRule: error spawning dialog box"); + Log::logger->log(Log::TRACE, "CDynamicPermissionRule: error spawning dialog box"); if (r->m_promiseResolverForExternal) r->m_promiseResolverForExternal->reject("error spawning dialog box"); r->m_promiseResolverForExternal.reset(); @@ -293,7 +293,7 @@ void CDynamicPermissionManager::askForPermission(wl_client* client, const std::s const std::string& result = pr->result(); - Debug::log(TRACE, "CDynamicPermissionRule: user returned {}", result); + Log::logger->log(Log::TRACE, "CDynamicPermissionRule: user returned {}", result); if (result.starts_with(ALLOW_ONCE)) r->m_allowMode = PERMISSION_RULE_ALLOW_MODE_ALLOW; |
