debug: move to hyprutils' logger (#12673)

This commit is contained in:
Vaxry 2025-12-18 17:23:24 +00:00 committed by GitHub
parent f88deb928a
commit 6175ecd4c4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
147 changed files with 1696 additions and 1709 deletions

View file

@ -24,7 +24,7 @@ PHLLS CLayerSurface::create(SP<CLayerShellResource> resource) {
pLS->m_wlSurface->assign(resource->m_surface.lock(), pLS);
if (!pMonitor) {
Debug::log(ERR, "New LS has no monitor??");
Log::logger->log(Log::ERR, "New LS has no monitor??");
return pLS;
}
@ -50,8 +50,8 @@ PHLLS CLayerSurface::create(SP<CLayerShellResource> resource) {
pLS->m_alpha->setValueAndWarp(0.f);
Debug::log(LOG, "LayerSurface {:x} (namespace {} layer {}) created on monitor {}", rc<uintptr_t>(resource.get()), resource->m_layerNamespace, sc<int>(pLS->m_layer),
pMonitor->m_name);
Log::logger->log(Log::DEBUG, "LayerSurface {:x} (namespace {} layer {}) created on monitor {}", rc<uintptr_t>(resource.get()), resource->m_layerNamespace,
sc<int>(pLS->m_layer), pMonitor->m_name);
return pLS;
}
@ -116,19 +116,19 @@ bool CLayerSurface::desktopComponent() const {
}
void CLayerSurface::onDestroy() {
Debug::log(LOG, "LayerSurface {:x} destroyed", rc<uintptr_t>(m_layerSurface.get()));
Log::logger->log(Log::DEBUG, "LayerSurface {:x} destroyed", rc<uintptr_t>(m_layerSurface.get()));
const auto PMONITOR = m_monitor.lock();
if (!PMONITOR)
Debug::log(WARN, "Layersurface destroyed on an invalid monitor (removed?)");
Log::logger->log(Log::WARN, "Layersurface destroyed on an invalid monitor (removed?)");
if (!m_fadingOut) {
if (m_mapped) {
Debug::log(LOG, "Forcing an unmap of a LS that did a straight destroy!");
Log::logger->log(Log::DEBUG, "Forcing an unmap of a LS that did a straight destroy!");
onUnmap();
} else {
Debug::log(LOG, "Removing LayerSurface that wasn't mapped.");
Log::logger->log(Log::DEBUG, "Removing LayerSurface that wasn't mapped.");
if (m_alpha)
g_pDesktopAnimationManager->startAnimation(m_self.lock(), CDesktopAnimationManager::ANIMATION_TYPE_OUT);
m_fadingOut = true;
@ -162,7 +162,7 @@ void CLayerSurface::onDestroy() {
}
void CLayerSurface::onMap() {
Debug::log(LOG, "LayerSurface {:x} mapped", rc<uintptr_t>(m_layerSurface.get()));
Log::logger->log(Log::DEBUG, "LayerSurface {:x} mapped", rc<uintptr_t>(m_layerSurface.get()));
m_mapped = true;
m_interactivity = m_layerSurface->m_current.interactivity;
@ -229,7 +229,7 @@ void CLayerSurface::onMap() {
}
void CLayerSurface::onUnmap() {
Debug::log(LOG, "LayerSurface {:x} unmapped", rc<uintptr_t>(m_layerSurface.get()));
Log::logger->log(Log::DEBUG, "LayerSurface {:x} unmapped", rc<uintptr_t>(m_layerSurface.get()));
g_pEventManager->postEvent(SHyprIPCEvent{.event = "closelayer", .data = m_layerSurface->m_layerNamespace});
EMIT_HOOK_EVENT("closeLayer", m_self.lock());
@ -237,7 +237,7 @@ void CLayerSurface::onUnmap() {
std::erase_if(g_pInputManager->m_exclusiveLSes, [this](const auto& other) { return !other || other == m_self; });
if (!m_monitor || g_pCompositor->m_unsafeState) {
Debug::log(WARN, "Layersurface unmapping on invalid monitor (removed?) ignoring.");
Log::logger->log(Log::WARN, "Layersurface unmapping on invalid monitor (removed?) ignoring.");
g_pCompositor->addToFadingOutSafe(m_self.lock());

View file

@ -137,7 +137,7 @@ void CPopup::initAllSignals() {
void CPopup::onNewPopup(SP<CXDGPopupResource> popup) {
const auto& POPUP = m_children.emplace_back(CPopup::create(popup, m_self));
POPUP->m_self = POPUP;
Debug::log(LOG, "New popup at {:x}", rc<uintptr_t>(this));
Log::logger->log(Log::DEBUG, "New popup at {:x}", rc<uintptr_t>(this));
}
void CPopup::onDestroy() {
@ -156,7 +156,7 @@ void CPopup::onDestroy() {
m_listeners.newPopup.reset();
if (m_fadingOut && m_alpha->isBeingAnimated()) {
Debug::log(LOG, "popup {:x}: skipping full destroy, animating", rc<uintptr_t>(this));
Log::logger->log(Log::DEBUG, "popup {:x}: skipping full destroy, animating", rc<uintptr_t>(this));
return;
}
@ -164,7 +164,7 @@ void CPopup::onDestroy() {
}
void CPopup::fullyDestroy() {
Debug::log(LOG, "popup {:x} fully destroying", rc<uintptr_t>(this));
Log::logger->log(Log::DEBUG, "popup {:x} fully destroying", rc<uintptr_t>(this));
g_pHyprRenderer->makeEGLCurrent();
std::erase_if(g_pHyprOpenGL->m_popupFramebuffers, [&](const auto& other) { return other.first.expired() || other.first == m_self; });
@ -203,7 +203,7 @@ void CPopup::onMap() {
m_alpha->setValueAndWarp(0.F);
*m_alpha = 1.F;
Debug::log(LOG, "popup {:x}: mapped", rc<uintptr_t>(this));
Log::logger->log(Log::DEBUG, "popup {:x}: mapped", rc<uintptr_t>(this));
}
void CPopup::onUnmap() {
@ -211,12 +211,12 @@ void CPopup::onUnmap() {
return;
if (!m_resource || !m_resource->m_surface) {
Debug::log(ERR, "CPopup: orphaned (no surface/resource) and unmaps??");
Log::logger->log(Log::ERR, "CPopup: orphaned (no surface/resource) and unmaps??");
onDestroy();
return;
}
Debug::log(LOG, "popup {:x}: unmapped", rc<uintptr_t>(this));
Log::logger->log(Log::DEBUG, "popup {:x}: unmapped", rc<uintptr_t>(this));
// if the popup committed a different size right now, we also need to damage the old size.
const Vector2D MAX_DAMAGE_SIZE = {std::max(m_lastSize.x, m_resource->m_surface->m_surface->m_current.size.x),
@ -271,7 +271,7 @@ void CPopup::onUnmap() {
void CPopup::onCommit(bool ignoreSiblings) {
if (!m_resource || !m_resource->m_surface) {
Debug::log(ERR, "CPopup: orphaned (no surface/resource) and commits??");
Log::logger->log(Log::ERR, "CPopup: orphaned (no surface/resource) and commits??");
onDestroy();
return;
}
@ -286,7 +286,7 @@ void CPopup::onCommit(bool ignoreSiblings) {
static auto PLOGDAMAGE = CConfigValue<Hyprlang::INT>("debug:log_damage");
if (*PLOGDAMAGE)
Debug::log(LOG, "Refusing to commit damage from a subsurface of {} because it's invisible.", m_windowOwner.lock());
Log::logger->log(Log::DEBUG, "Refusing to commit damage from a subsurface of {} because it's invisible.", m_windowOwner.lock());
return;
}
@ -318,7 +318,7 @@ void CPopup::onCommit(bool ignoreSiblings) {
}
void CPopup::onReposition() {
Debug::log(LOG, "Popup {:x} requests reposition", rc<uintptr_t>(this));
Log::logger->log(Log::DEBUG, "Popup {:x} requests reposition", rc<uintptr_t>(this));
m_requestedReposition = true;

View file

@ -142,7 +142,7 @@ void CSubsurface::onCommit() {
static auto PLOGDAMAGE = CConfigValue<Hyprlang::INT>("debug:log_damage");
if (*PLOGDAMAGE)
Debug::log(LOG, "Refusing to commit damage from a subsurface of {} because it's invisible.", m_windowParent.lock());
Log::logger->log(Log::DEBUG, "Refusing to commit damage from a subsurface of {} because it's invisible.", m_windowParent.lock());
return;
}

View file

@ -132,7 +132,7 @@ void CWLSurface::destroy() {
m_resource.reset();
Debug::log(LOG, "CWLSurface {:x} called destroy()", rc<uintptr_t>(this));
Log::logger->log(Log::DEBUG, "CWLSurface {:x} called destroy()", rc<uintptr_t>(this));
}
void CWLSurface::init() {
@ -145,7 +145,7 @@ void CWLSurface::init() {
m_listeners.destroy = m_resource->m_events.destroy.listen([this] { destroy(); });
Debug::log(LOG, "CWLSurface {:x} called init()", rc<uintptr_t>(this));
Log::logger->log(Log::DEBUG, "CWLSurface {:x} called init()", rc<uintptr_t>(this));
}
SP<IView> CWLSurface::view() const {

View file

@ -10,6 +10,7 @@
#include <any>
#include <bit>
#include <fstream>
#include <string_view>
#include "Window.hpp"
#include "LayerSurface.hpp"
@ -719,7 +720,7 @@ void CWindow::applyGroupRules() {
void CWindow::createGroup() {
if (m_groupData.deny) {
Debug::log(LOG, "createGroup: window:{:x},title:{} is denied as a group, ignored", rc<uintptr_t>(this), this->m_title);
Log::logger->log(Log::DEBUG, "createGroup: window:{:x},title:{} is denied as a group, ignored", rc<uintptr_t>(this), this->m_title);
return;
}
@ -747,7 +748,7 @@ void CWindow::createGroup() {
void CWindow::destroyGroup() {
if (m_groupData.pNextWindow == m_self) {
if (m_groupRules & GROUP_SET_ALWAYS) {
Debug::log(LOG, "destoryGroup: window:{:x},title:{} has rule [group set always], ignored", rc<uintptr_t>(this), this->m_title);
Log::logger->log(Log::DEBUG, "destoryGroup: window:{:x},title:{} has rule [group set always], ignored", rc<uintptr_t>(this), this->m_title);
return;
}
m_groupData.pNextWindow.reset();
@ -1305,7 +1306,7 @@ void CWindow::activate(bool force) {
return;
if (!m_isMapped) {
Debug::log(LOG, "Ignoring CWindow::activate focus/warp, window is not mapped yet.");
Log::logger->log(Log::DEBUG, "Ignoring CWindow::activate focus/warp, window is not mapped yet.");
return;
}
@ -1367,7 +1368,7 @@ void CWindow::onUpdateMeta() {
EMIT_HOOK_EVENT("activeWindow", m_self.lock());
}
Debug::log(LOG, "Window {:x} set title to {}", rc<uintptr_t>(this), m_title);
Log::logger->log(Log::DEBUG, "Window {:x} set title to {}", rc<uintptr_t>(this), m_title);
doUpdate = true;
}
@ -1381,7 +1382,7 @@ void CWindow::onUpdateMeta() {
EMIT_HOOK_EVENT("activeWindow", m_self.lock());
}
Debug::log(LOG, "Window {:x} set class to {}", rc<uintptr_t>(this), m_class);
Log::logger->log(Log::DEBUG, "Window {:x} set class to {}", rc<uintptr_t>(this), m_class);
doUpdate = true;
}
@ -1442,7 +1443,7 @@ void CWindow::onResourceChangeX11() {
// could be first assoc and we need to catch the class
onUpdateMeta();
Debug::log(LOG, "xwayland window {:x} -> association to {:x}", rc<uintptr_t>(m_xwaylandSurface.get()), rc<uintptr_t>(m_wlSurface->resource().get()));
Log::logger->log(Log::DEBUG, "xwayland window {:x} -> association to {:x}", rc<uintptr_t>(m_xwaylandSurface.get()), rc<uintptr_t>(m_wlSurface->resource().get()));
}
void CWindow::onX11ConfigureRequest(CBox box) {
@ -1649,8 +1650,8 @@ void CWindow::updateX11SurfaceScale() {
void CWindow::sendWindowSize(bool force) {
const auto PMONITOR = m_monitor.lock();
Debug::log(TRACE, "sendWindowSize: window:{:x},title:{} with real pos {}, real size {} (force: {})", rc<uintptr_t>(this), this->m_title, m_realPosition->goal(),
m_realSize->goal(), force);
Log::logger->log(Log::TRACE, "sendWindowSize: window:{:x},title:{} with real pos {}, real size {} (force: {})", rc<uintptr_t>(this), this->m_title, m_realPosition->goal(),
m_realSize->goal(), force);
// TODO: this should be decoupled from setWindowSize IMO
const auto REPORTPOS = realToReportPosition();
@ -1682,7 +1683,7 @@ void CWindow::setContentType(NContentType::eContentType contentType) {
m_wlSurface->resource()->m_contentType = PROTO::contentType->getContentType(m_wlSurface->resource());
// else disallow content type change if proto is used?
Debug::log(INFO, "ContentType for window {}", sc<int>(contentType));
Log::logger->log(Log::INFO, "ContentType for window {}", sc<int>(contentType));
m_wlSurface->resource()->m_contentType->m_value = contentType;
}
@ -1952,13 +1953,13 @@ void CWindow::mapWindow() {
const auto WINDOWENV = getEnv();
if (WINDOWENV.contains("HL_INITIAL_WORKSPACE_TOKEN")) {
const auto SZTOKEN = WINDOWENV.at("HL_INITIAL_WORKSPACE_TOKEN");
Debug::log(LOG, "New window contains HL_INITIAL_WORKSPACE_TOKEN: {}", SZTOKEN);
Log::logger->log(Log::DEBUG, "New window contains HL_INITIAL_WORKSPACE_TOKEN: {}", SZTOKEN);
const auto TOKEN = g_pTokenManager->getToken(SZTOKEN);
if (TOKEN) {
// find workspace and use it
Desktop::View::SInitialWorkspaceToken WS = std::any_cast<Desktop::View::SInitialWorkspaceToken>(TOKEN->m_data);
Debug::log(LOG, "HL_INITIAL_WORKSPACE_TOKEN {} -> {}", SZTOKEN, WS.workspace);
Log::logger->log(Log::DEBUG, "HL_INITIAL_WORKSPACE_TOKEN {} -> {}", SZTOKEN, WS.workspace);
if (g_pCompositor->getWorkspaceByString(WS.workspace) != m_workspace) {
requestedWorkspace = WS.workspace;
@ -2023,10 +2024,10 @@ void CWindow::mapWindow() {
m_workspace = PMONITOR->m_activeSpecialWorkspace ? PMONITOR->m_activeSpecialWorkspace : PMONITOR->m_activeWorkspace;
PWORKSPACE = m_workspace;
Debug::log(LOG, "Rule monitor, applying to {:mw}", m_self.lock());
Log::logger->log(Log::DEBUG, "Rule monitor, applying to {:mw}", m_self.lock());
requestedFSMonitor = MONITOR_INVALID;
} else
Debug::log(ERR, "No monitor in monitor {} rule", MONITORSTR);
Log::logger->log(Log::ERR, "No monitor in monitor {} rule", MONITORSTR);
}
}
@ -2043,7 +2044,7 @@ void CWindow::mapWindow() {
if (JUSTWORKSPACE == PWORKSPACE->m_name || JUSTWORKSPACE == "name:" + PWORKSPACE->m_name)
requestedWorkspace = "";
Debug::log(LOG, "Rule workspace matched by {}, {} applied.", m_self.lock(), m_ruleApplicator->static_.workspace);
Log::logger->log(Log::DEBUG, "Rule workspace matched by {}, {} applied.", m_self.lock(), m_ruleApplicator->static_.workspace);
requestedFSMonitor = MONITOR_INVALID;
}
@ -2072,7 +2073,7 @@ void CWindow::mapWindow() {
else if (var == "fullscreenoutput")
m_suppressedEvents |= Desktop::View::SUPPRESS_FULLSCREEN_OUTPUT;
else
Debug::log(ERR, "Error while parsing suppressevent windowrule: unknown event type {}", var);
Log::logger->log(Log::ERR, "Error while parsing suppressevent windowrule: unknown event type {}", var);
}
}
@ -2117,7 +2118,7 @@ void CWindow::mapWindow() {
else if (vPrev == "lock")
m_groupRules |= Desktop::View::GROUP_LOCK_ALWAYS;
else
Debug::log(ERR, "windowrule `group` does not support `{} always`", vPrev);
Log::logger->log(Log::ERR, "windowrule `group` does not support `{} always`", vPrev);
}
vPrev = v;
}
@ -2200,7 +2201,7 @@ void CWindow::mapWindow() {
m_workspace = PMONITOR->m_activeSpecialWorkspace ? PMONITOR->m_activeSpecialWorkspace : PMONITOR->m_activeWorkspace;
PWORKSPACE = m_workspace;
Debug::log(LOG, "Requested monitor, applying to {:mw}", m_self.lock());
Log::logger->log(Log::DEBUG, "Requested monitor, applying to {:mw}", m_self.lock());
}
if (PWORKSPACE->m_defaultFloating)
@ -2231,7 +2232,7 @@ void CWindow::mapWindow() {
if (!m_ruleApplicator->static_.size.empty()) {
const auto COMPUTED = calculateExpression(m_ruleApplicator->static_.size);
if (!COMPUTED)
Debug::log(ERR, "failed to parse {} as an expression", m_ruleApplicator->static_.size);
Log::logger->log(Log::ERR, "failed to parse {} as an expression", m_ruleApplicator->static_.size);
else {
*m_realSize = *COMPUTED;
setHidden(false);
@ -2241,7 +2242,7 @@ void CWindow::mapWindow() {
if (!m_ruleApplicator->static_.position.empty()) {
const auto COMPUTED = calculateExpression(m_ruleApplicator->static_.position);
if (!COMPUTED)
Debug::log(ERR, "failed to parse {} as an expression", m_ruleApplicator->static_.position);
Log::logger->log(Log::ERR, "failed to parse {} as an expression", m_ruleApplicator->static_.position);
else {
*m_realPosition = *COMPUTED + PMONITOR->m_position;
setHidden(false);
@ -2266,7 +2267,7 @@ void CWindow::mapWindow() {
if (!m_ruleApplicator->static_.size.empty()) {
const auto COMPUTED = calculateExpression(m_ruleApplicator->static_.size);
if (!COMPUTED)
Debug::log(ERR, "failed to parse {} as an expression", m_ruleApplicator->static_.size);
Log::logger->log(Log::ERR, "failed to parse {} as an expression", m_ruleApplicator->static_.size);
else {
setPseudo = true;
m_pseudoSize = *COMPUTED;
@ -2359,7 +2360,7 @@ void CWindow::mapWindow() {
m_firstMap = false;
Debug::log(LOG, "Map request dispatched, monitor {}, window pos: {:5j}, window size: {:5j}", PMONITOR->m_name, m_realPosition->goal(), m_realSize->goal());
Log::logger->log(Log::DEBUG, "Map request dispatched, monitor {}, window pos: {:5j}, window size: {:5j}", PMONITOR->m_name, m_realPosition->goal(), m_realSize->goal());
// emit the hook event here after basic stuff has been initialized
EMIT_HOOK_EVENT("openWindow", m_self.lock());
@ -2398,7 +2399,7 @@ void CWindow::mapWindow() {
}
void CWindow::unmapWindow() {
Debug::log(LOG, "{:c} unmapped", m_self.lock());
Log::logger->log(Log::DEBUG, "{:c} unmapped", m_self.lock());
static auto PEXITRETAINSFS = CConfigValue<Hyprlang::INT>("misc:exit_window_retains_fullscreen");
@ -2406,7 +2407,7 @@ void CWindow::unmapWindow() {
const auto CURRENTFSMODE = m_fullscreenState.internal;
if (!wlSurface()->exists() || !m_isMapped) {
Debug::log(WARN, "{} unmapped without being mapped??", m_self.lock());
Log::logger->log(Log::WARN, "{} unmapped without being mapped??", m_self.lock());
m_fadingOut = false;
return;
}
@ -2422,7 +2423,7 @@ void CWindow::unmapWindow() {
EMIT_HOOK_EVENT("closeWindow", m_self.lock());
if (m_isFloating && !m_isX11 && m_ruleApplicator->persistentSize().valueOrDefault()) {
Debug::log(LOG, "storing floating size {}x{} for window {}::{} on close", m_realSize->value().x, m_realSize->value().y, m_class, m_title);
Log::logger->log(Log::DEBUG, "storing floating size {}x{} for window {}::{} on close", m_realSize->value().x, m_realSize->value().y, m_class, m_title);
g_pConfigManager->storeFloatingSize(m_self.lock(), m_realSize->value());
}
@ -2485,7 +2486,7 @@ void CWindow::unmapWindow() {
else
PWINDOWCANDIDATE = g_pLayoutManager->getCurrentLayout()->getNextWindowCandidate(m_self.lock());
Debug::log(LOG, "On closed window, new focused candidate is {}", PWINDOWCANDIDATE);
Log::logger->log(Log::DEBUG, "On closed window, new focused candidate is {}", PWINDOWCANDIDATE);
if (PWINDOWCANDIDATE != Desktop::focusState()->window() && PWINDOWCANDIDATE) {
Desktop::focusState()->fullWindowFocus(PWINDOWCANDIDATE);
@ -2505,7 +2506,7 @@ void CWindow::unmapWindow() {
EMIT_HOOK_EVENT("activeWindow", PHLWINDOW{nullptr});
}
} else {
Debug::log(LOG, "Unmapped was not focused, ignoring a refocus.");
Log::logger->log(Log::DEBUG, "Unmapped was not focused, ignoring a refocus.");
}
m_fadingOut = true;
@ -2533,7 +2534,7 @@ void CWindow::commitWindow() {
if (!m_isX11 && m_xdgSurface->m_initialCommit) {
Vector2D predSize = g_pLayoutManager->getCurrentLayout()->predictSizeForNewWindow(m_self.lock());
Debug::log(LOG, "Layout predicts size {} for {}", predSize, m_self.lock());
Log::logger->log(Log::DEBUG, "Layout predicts size {} for {}", predSize, m_self.lock());
m_xdgSurface->m_toplevel->setSize(predSize);
return;
@ -2594,7 +2595,7 @@ void CWindow::commitWindow() {
}
void CWindow::destroyWindow() {
Debug::log(LOG, "{:c} destroyed, queueing.", m_self.lock());
Log::logger->log(Log::DEBUG, "{:c} destroyed, queueing.", m_self.lock());
if (m_self.lock() == Desktop::focusState()->window()) {
Desktop::focusState()->window().reset();
@ -2612,7 +2613,7 @@ void CWindow::destroyWindow() {
m_xdgSurface.reset();
if (!m_fadingOut) {
Debug::log(LOG, "Unmapped {} removed instantly", m_self.lock());
Log::logger->log(Log::DEBUG, "Unmapped {} removed instantly", m_self.lock());
g_pCompositor->removeWindowFromVectorSafe(m_self.lock()); // most likely X11 unmanaged or sumn
}
@ -2623,11 +2624,11 @@ void CWindow::destroyWindow() {
}
void CWindow::activateX11() {
Debug::log(LOG, "X11 Activate request for window {}", m_self.lock());
Log::logger->log(Log::DEBUG, "X11 Activate request for window {}", m_self.lock());
if (isX11OverrideRedirect()) {
Debug::log(LOG, "Unmanaged X11 {} requests activate", m_self.lock());
Log::logger->log(Log::DEBUG, "Unmanaged X11 {} requests activate", m_self.lock());
if (Desktop::focusState()->window() && Desktop::focusState()->window()->getPID() != getPID())
return;
@ -2669,7 +2670,7 @@ void CWindow::unmanagedSetGeometry() {
if (abs(std::floor(POS.x) - LOGICALPOS.x) > 2 || abs(std::floor(POS.y) - LOGICALPOS.y) > 2 || abs(std::floor(SIZ.x) - m_xwaylandSurface->m_geometry.width) > 2 ||
abs(std::floor(SIZ.y) - m_xwaylandSurface->m_geometry.height) > 2) {
Debug::log(LOG, "Unmanaged window {} requests geometry update to {:j} {:j}", m_self.lock(), LOGICALPOS, m_xwaylandSurface->m_geometry.size());
Log::logger->log(Log::DEBUG, "Unmanaged window {} requests geometry update to {:j} {:j}", m_self.lock(), LOGICALPOS, m_xwaylandSurface->m_geometry.size());
g_pHyprRenderer->damageWindow(m_self.lock());
m_realPosition->setValueAndWarp(Vector2D(LOGICALPOS.x, LOGICALPOS.y));