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

@ -277,19 +277,19 @@ void CWLSurfaceResource::enter(PHLMONITOR monitor) {
if UNLIKELY (!PROTO::outputs.contains(monitor->m_name)) {
// can happen on unplug/replug
LOGM(ERR, "enter() called on a non-existent output global");
LOGM(Log::ERR, "enter() called on a non-existent output global");
return;
}
if UNLIKELY (PROTO::outputs.at(monitor->m_name)->isDefunct()) {
LOGM(ERR, "enter() called on a defunct output global");
LOGM(Log::ERR, "enter() called on a defunct output global");
return;
}
auto output = PROTO::outputs.at(monitor->m_name)->outputResourceFrom(m_client);
if UNLIKELY (!output || !output->getResource() || !output->getResource()->resource()) {
LOGM(ERR, "Cannot enter surface {:x} to {}, client hasn't bound the output", (uintptr_t)this, monitor->m_name);
LOGM(Log::ERR, "Cannot enter surface {:x} to {}, client hasn't bound the output", (uintptr_t)this, monitor->m_name);
return;
}
@ -306,7 +306,7 @@ void CWLSurfaceResource::leave(PHLMONITOR monitor) {
auto output = PROTO::outputs.at(monitor->m_name)->outputResourceFrom(m_client);
if UNLIKELY (!output) {
LOGM(ERR, "Cannot leave surface {:x} from {}, client hasn't bound the output", (uintptr_t)this, monitor->m_name);
LOGM(Log::ERR, "Cannot leave surface {:x} from {}, client hasn't bound the output", (uintptr_t)this, monitor->m_name);
return;
}
@ -627,7 +627,7 @@ void CWLSurfaceResource::updateCursorShm(CRegion damage) {
auto shmAttrs = buf->shm();
if (!shmAttrs.success) {
LOGM(TRACE, "updateCursorShm: ignoring, not a shm buffer");
LOGM(Log::TRACE, "updateCursorShm: ignoring, not a shm buffer");
return;
}
@ -681,7 +681,7 @@ CWLCompositorResource::CWLCompositorResource(SP<CWlCompositor> resource_) : m_re
RESOURCE->m_self = RESOURCE;
RESOURCE->m_stateQueue = CSurfaceStateQueue(RESOURCE);
LOGM(LOG, "New wl_surface with id {} at {:x}", id, (uintptr_t)RESOURCE.get());
LOGM(Log::DEBUG, "New wl_surface with id {} at {:x}", id, (uintptr_t)RESOURCE.get());
PROTO::compositor->m_events.newSurface.emit(RESOURCE);
});
@ -697,7 +697,7 @@ CWLCompositorResource::CWLCompositorResource(SP<CWlCompositor> resource_) : m_re
RESOURCE->m_self = RESOURCE;
LOGM(LOG, "New wl_region with id {} at {:x}", id, (uintptr_t)RESOURCE.get());
LOGM(Log::DEBUG, "New wl_region with id {} at {:x}", id, (uintptr_t)RESOURCE.get());
});
}

View file

@ -26,16 +26,16 @@ CWLDataOfferResource::CWLDataOfferResource(SP<CWlDataOffer> resource_, SP<IDataS
m_resource->setAccept([this](CWlDataOffer* r, uint32_t serial, const char* mime) {
if (!m_source) {
LOGM(WARN, "Possible bug: Accept on an offer w/o a source");
LOGM(Log::WARN, "Possible bug: Accept on an offer w/o a source");
return;
}
if (m_dead) {
LOGM(WARN, "Possible bug: Accept on an offer that's dead");
LOGM(Log::WARN, "Possible bug: Accept on an offer that's dead");
return;
}
LOGM(LOG, "Offer {:x} accepts data from source {:x} with mime {}", (uintptr_t)this, (uintptr_t)m_source.get(), mime ? mime : "null");
LOGM(Log::DEBUG, "Offer {:x} accepts data from source {:x} with mime {}", (uintptr_t)this, (uintptr_t)m_source.get(), mime ? mime : "null");
m_source->accepted(mime ? mime : "");
m_accepted = mime;
@ -44,19 +44,19 @@ CWLDataOfferResource::CWLDataOfferResource(SP<CWlDataOffer> resource_, SP<IDataS
m_resource->setReceive([this](CWlDataOffer* r, const char* mime, int fd) {
CFileDescriptor sendFd{fd};
if (!m_source) {
LOGM(WARN, "Possible bug: Receive on an offer w/o a source");
LOGM(Log::WARN, "Possible bug: Receive on an offer w/o a source");
return;
}
if (m_dead) {
LOGM(WARN, "Possible bug: Receive on an offer that's dead");
LOGM(Log::WARN, "Possible bug: Receive on an offer that's dead");
return;
}
LOGM(LOG, "Offer {:x} asks to send data from source {:x}", (uintptr_t)this, (uintptr_t)m_source.get());
LOGM(Log::DEBUG, "Offer {:x} asks to send data from source {:x}", (uintptr_t)this, (uintptr_t)m_source.get());
if (!m_accepted) {
LOGM(WARN, "Offer was never accepted, sending accept first");
LOGM(Log::WARN, "Offer was never accepted, sending accept first");
m_source->accepted(mime ? mime : "");
}
@ -101,13 +101,13 @@ void CWLDataOfferResource::sendData() {
else if (SOURCEACTIONS & WL_DATA_DEVICE_MANAGER_DND_ACTION_COPY)
m_resource->sendAction(WL_DATA_DEVICE_MANAGER_DND_ACTION_COPY);
else {
LOGM(ERR, "Client bug? dnd source has no action move or copy. Sending move, f this.");
LOGM(Log::ERR, "Client bug? dnd source has no action move or copy. Sending move, f this.");
m_resource->sendAction(WL_DATA_DEVICE_MANAGER_DND_ACTION_MOVE);
}
}
for (auto const& m : m_source->mimes()) {
LOGM(LOG, " | offer {:x} supports mime {}", (uintptr_t)this, m);
LOGM(Log::DEBUG, " | offer {:x} supports mime {}", (uintptr_t)this, m);
m_resource->sendOffer(m.c_str());
}
}
@ -147,7 +147,7 @@ CWLDataSourceResource::CWLDataSourceResource(SP<CWlDataSource> resource_, SP<CWL
m_resource->setOffer([this](CWlDataSource* r, const char* mime) { m_mimeTypes.emplace_back(mime); });
m_resource->setSetActions([this](CWlDataSource* r, uint32_t a) {
LOGM(LOG, "DataSource {:x} actions {}", (uintptr_t)this, a);
LOGM(Log::DEBUG, "DataSource {:x} actions {}", (uintptr_t)this, a);
m_supportedActions = a;
});
}
@ -173,7 +173,7 @@ void CWLDataSourceResource::accepted(const std::string& mime) {
}
if (std::ranges::find(m_mimeTypes, mime) == m_mimeTypes.end()) {
LOGM(ERR, "Compositor/App bug: CWLDataSourceResource::sendAccepted with non-existent mime");
LOGM(Log::ERR, "Compositor/App bug: CWLDataSourceResource::sendAccepted with non-existent mime");
return;
}
@ -186,7 +186,7 @@ std::vector<std::string> CWLDataSourceResource::mimes() {
void CWLDataSourceResource::send(const std::string& mime, CFileDescriptor fd) {
if (std::ranges::find(m_mimeTypes, mime) == m_mimeTypes.end()) {
LOGM(ERR, "Compositor/App bug: CWLDataSourceResource::sendAskSend with non-existent mime");
LOGM(Log::ERR, "Compositor/App bug: CWLDataSourceResource::sendAskSend with non-existent mime");
return;
}
@ -248,13 +248,13 @@ CWLDataDeviceResource::CWLDataDeviceResource(SP<CWlDataDevice> resource_) : m_re
m_resource->setSetSelection([](CWlDataDevice* r, wl_resource* sourceR, uint32_t serial) {
auto source = sourceR ? CWLDataSourceResource::fromResource(sourceR) : CSharedPointer<CWLDataSourceResource>{};
if (!source) {
LOGM(LOG, "Reset selection received");
LOGM(Log::DEBUG, "Reset selection received");
g_pSeatManager->setCurrentSelection(nullptr);
return;
}
if (source && source->m_used)
LOGM(WARN, "setSelection on a used resource. By protocol, this is a violation, but firefox et al insist on doing this.");
LOGM(Log::WARN, "setSelection on a used resource. By protocol, this is a violation, but firefox et al insist on doing this.");
source->markUsed();
@ -264,12 +264,12 @@ CWLDataDeviceResource::CWLDataDeviceResource(SP<CWlDataDevice> resource_) : m_re
m_resource->setStartDrag([](CWlDataDevice* r, wl_resource* sourceR, wl_resource* origin, wl_resource* icon, uint32_t serial) {
auto source = CWLDataSourceResource::fromResource(sourceR);
if (!source) {
LOGM(ERR, "No source in drag");
LOGM(Log::ERR, "No source in drag");
return;
}
if (source && source->m_used)
LOGM(WARN, "setSelection on a used resource. By protocol, this is a violation, but firefox et al insist on doing this.");
LOGM(Log::WARN, "setSelection on a used resource. By protocol, this is a violation, but firefox et al insist on doing this.");
source->markUsed();
@ -357,13 +357,13 @@ CWLDataDeviceManagerResource::CWLDataDeviceManagerResource(SP<CWlDataDeviceManag
}
if (!m_device)
LOGM(WARN, "New data source before a device was created");
LOGM(Log::WARN, "New data source before a device was created");
RESOURCE->m_self = RESOURCE;
m_sources.emplace_back(RESOURCE);
LOGM(LOG, "New data source bound at {:x}", (uintptr_t)RESOURCE.get());
LOGM(Log::DEBUG, "New data source bound at {:x}", (uintptr_t)RESOURCE.get());
});
m_resource->setGetDataDevice([this](CWlDataDeviceManager* r, uint32_t id, wl_resource* seat) {
@ -383,7 +383,7 @@ CWLDataDeviceManagerResource::CWLDataDeviceManagerResource(SP<CWlDataDeviceManag
s->m_device = RESOURCE;
}
LOGM(LOG, "New data device bound at {:x}", (uintptr_t)RESOURCE.get());
LOGM(Log::DEBUG, "New data device bound at {:x}", (uintptr_t)RESOURCE.get());
});
}
@ -407,7 +407,7 @@ void CWLDataDeviceProtocol::bindManager(wl_client* client, void* data, uint32_t
return;
}
LOGM(LOG, "New datamgr resource bound at {:x}", (uintptr_t)RESOURCE.get());
LOGM(Log::DEBUG, "New datamgr resource bound at {:x}", (uintptr_t)RESOURCE.get());
}
void CWLDataDeviceProtocol::destroyResource(CWLDataDeviceManagerResource* seat) {
@ -463,11 +463,11 @@ void CWLDataDeviceProtocol::sendSelectionToDevice(SP<IDataDevice> dev, SP<IDataS
#endif
if UNLIKELY (!offer) {
LOGM(ERR, "No offer could be created in sendSelectionToDevice");
LOGM(Log::ERR, "No offer could be created in sendSelectionToDevice");
return;
}
LOGM(LOG, "New {} offer {:x} for data source {:x}", offer->type() == DATA_SOURCE_TYPE_WAYLAND ? "wayland" : "X11", (uintptr_t)offer.get(), (uintptr_t)sel.get());
LOGM(Log::DEBUG, "New {} offer {:x} for data source {:x}", offer->type() == DATA_SOURCE_TYPE_WAYLAND ? "wayland" : "X11", (uintptr_t)offer.get(), (uintptr_t)sel.get());
dev->sendDataOffer(offer);
if (const auto WL = offer->getWayland(); WL)
@ -488,7 +488,7 @@ void CWLDataDeviceProtocol::setSelection(SP<IDataSource> source) {
}
if (!source) {
LOGM(LOG, "resetting selection");
LOGM(Log::DEBUG, "resetting selection");
if (!g_pSeatManager->m_state.keyboardFocusResource)
return;
@ -500,7 +500,7 @@ void CWLDataDeviceProtocol::setSelection(SP<IDataSource> source) {
return;
}
LOGM(LOG, "New selection for data source {:x}", (uintptr_t)source.get());
LOGM(Log::DEBUG, "New selection for data source {:x}", (uintptr_t)source.get());
if (!g_pSeatManager->m_state.keyboardFocusResource)
return;
@ -508,12 +508,12 @@ void CWLDataDeviceProtocol::setSelection(SP<IDataSource> source) {
auto DESTDEVICE = dataDeviceForClient(g_pSeatManager->m_state.keyboardFocusResource->client());
if (!DESTDEVICE) {
LOGM(LOG, "CWLDataDeviceProtocol::setSelection: cannot send selection to a client without a data_device");
LOGM(Log::DEBUG, "CWLDataDeviceProtocol::setSelection: cannot send selection to a client without a data_device");
return;
}
if (DESTDEVICE->type() != DATA_SOURCE_TYPE_WAYLAND) {
LOGM(LOG, "CWLDataDeviceProtocol::setSelection: ignoring X11 data device");
LOGM(Log::DEBUG, "CWLDataDeviceProtocol::setSelection: ignoring X11 data device");
return;
}
@ -527,7 +527,7 @@ void CWLDataDeviceProtocol::updateSelection() {
auto DESTDEVICE = dataDeviceForClient(g_pSeatManager->m_state.keyboardFocusResource->client());
if (!DESTDEVICE) {
LOGM(LOG, "CWLDataDeviceProtocol::onKeyboardFocus: cannot send selection to a client without a data_device");
LOGM(Log::DEBUG, "CWLDataDeviceProtocol::onKeyboardFocus: cannot send selection to a client without a data_device");
return;
}
@ -557,14 +557,14 @@ void CWLDataDeviceProtocol::onDndPointerFocus() {
void CWLDataDeviceProtocol::initiateDrag(WP<CWLDataSourceResource> currentSource, SP<CWLSurfaceResource> dragSurface, SP<CWLSurfaceResource> origin) {
if (m_dnd.currentSource) {
LOGM(WARN, "New drag started while old drag still active??");
LOGM(Log::WARN, "New drag started while old drag still active??");
abortDrag();
}
Cursor::overrideController->setOverride("grabbing", Cursor::CURSOR_OVERRIDE_DND);
m_dnd.overriddenCursor = true;
LOGM(LOG, "initiateDrag: source {:x}, surface: {:x}, origin: {:x}", (uintptr_t)currentSource.get(), (uintptr_t)dragSurface, (uintptr_t)origin);
LOGM(Log::DEBUG, "initiateDrag: source {:x}, surface: {:x}, origin: {:x}", (uintptr_t)currentSource.get(), (uintptr_t)dragSurface, (uintptr_t)origin);
currentSource->m_used = true;
@ -589,20 +589,20 @@ void CWLDataDeviceProtocol::initiateDrag(WP<CWLDataSourceResource> currentSource
m_dnd.mouseButton = g_pHookSystem->hookDynamic("mouseButton", [this](void* self, SCallbackInfo& info, std::any e) {
auto E = std::any_cast<IPointer::SButtonEvent>(e);
if (E.state == WL_POINTER_BUTTON_STATE_RELEASED) {
LOGM(LOG, "Dropping drag on mouseUp");
LOGM(Log::DEBUG, "Dropping drag on mouseUp");
dropDrag();
}
});
m_dnd.touchUp = g_pHookSystem->hookDynamic("touchUp", [this](void* self, SCallbackInfo& info, std::any e) {
LOGM(LOG, "Dropping drag on touchUp");
LOGM(Log::DEBUG, "Dropping drag on touchUp");
dropDrag();
});
m_dnd.tabletTip = g_pHookSystem->hookDynamic("tabletTip", [this](void* self, SCallbackInfo& info, std::any e) {
auto E = std::any_cast<CTablet::STipEvent>(e);
if (!E.in) {
LOGM(LOG, "Dropping drag on tablet tipUp");
LOGM(Log::DEBUG, "Dropping drag on tablet tipUp");
dropDrag();
}
});
@ -621,7 +621,7 @@ void CWLDataDeviceProtocol::initiateDrag(WP<CWLDataSourceResource> currentSource
return;
m_dnd.focusedDevice->sendMotion(Time::millis(Time::steadyNow()), V - box->pos());
LOGM(LOG, "Drag motion {}", V - box->pos());
LOGM(Log::DEBUG, "Drag motion {}", V - box->pos());
}
});
@ -639,7 +639,7 @@ void CWLDataDeviceProtocol::initiateDrag(WP<CWLDataSourceResource> currentSource
return;
m_dnd.focusedDevice->sendMotion(E.timeMs, E.pos);
LOGM(LOG, "Drag motion {}", E.pos);
LOGM(Log::DEBUG, "Drag motion {}", E.pos);
}
});
@ -689,11 +689,11 @@ void CWLDataDeviceProtocol::updateDrag() {
#endif
if (!offer) {
LOGM(ERR, "No offer could be created in updateDrag");
LOGM(Log::ERR, "No offer could be created in updateDrag");
return;
}
LOGM(LOG, "New {} dnd offer {:x} for data source {:x}", offer->type() == DATA_SOURCE_TYPE_WAYLAND ? "wayland" : "X11", (uintptr_t)offer.get(),
LOGM(Log::DEBUG, "New {} dnd offer {:x} for data source {:x}", offer->type() == DATA_SOURCE_TYPE_WAYLAND ? "wayland" : "X11", (uintptr_t)offer.get(),
(uintptr_t)m_dnd.currentSource.get());
m_dnd.focusedDevice->sendDataOffer(offer);

View file

@ -95,7 +95,7 @@ CWLOutputProtocol::CWLOutputProtocol(const wl_interface* iface, const int& ver,
void CWLOutputProtocol::bindManager(wl_client* client, void* data, uint32_t ver, uint32_t id) {
if UNLIKELY (m_defunct)
Debug::log(WARN, "[wl_output] Binding a wl_output that's inert?? Possible client bug.");
Log::logger->log(Log::WARN, "[wl_output] Binding a wl_output that's inert?? Possible client bug.");
const auto RESOURCE = m_outputs.emplace_back(makeShared<CWLOutputResource>(makeShared<CWlOutput>(client, ver, id), m_monitor.lock()));

View file

@ -118,7 +118,7 @@ CWLPointerResource::CWLPointerResource(SP<CWlPointer> resource_, SP<CWLSeatResou
m_resource->setSetCursor([this](CWlPointer* r, uint32_t serial, wl_resource* surf, int32_t hotX, int32_t hotY) {
if (!m_owner) {
LOGM(ERR, "Client bug: setCursor when seatClient is already dead");
LOGM(Log::ERR, "Client bug: setCursor when seatClient is already dead");
return;
}
@ -162,7 +162,7 @@ void CWLPointerResource::sendEnter(SP<CWLSurfaceResource> surface, const Vector2
return;
if (m_currentSurface) {
LOGM(WARN, "requested CWLPointerResource::sendEnter without sendLeave first.");
LOGM(Log::WARN, "requested CWLPointerResource::sendEnter without sendLeave first.");
sendLeave();
}
@ -218,10 +218,10 @@ void CWLPointerResource::sendButton(uint32_t timeMs, uint32_t button, wl_pointer
return;
if (state == WL_POINTER_BUTTON_STATE_RELEASED && std::ranges::find(m_pressedButtons, button) == m_pressedButtons.end()) {
LOGM(ERR, "sendButton release on a non-pressed button");
LOGM(Log::ERR, "sendButton release on a non-pressed button");
return;
} else if (state == WL_POINTER_BUTTON_STATE_PRESSED && std::ranges::find(m_pressedButtons, button) != m_pressedButtons.end()) {
LOGM(ERR, "sendButton press on a non-pressed button");
LOGM(Log::ERR, "sendButton press on a non-pressed button");
return;
}
@ -328,7 +328,7 @@ CWLKeyboardResource::CWLKeyboardResource(SP<CWlKeyboard> resource_, SP<CWLSeatRe
m_resource->setOnDestroy([this](CWlKeyboard* r) { PROTO::seat->destroyResource(this); });
if (!g_pSeatManager->m_keyboard) {
LOGM(ERR, "No keyboard on bound wl_keyboard??");
LOGM(Log::ERR, "No keyboard on bound wl_keyboard??");
return;
}
@ -380,7 +380,7 @@ void CWLKeyboardResource::sendEnter(SP<CWLSurfaceResource> surface, wl_array* ke
return;
if (m_currentSurface) {
LOGM(WARN, "requested CWLKeyboardResource::sendEnter without sendLeave first.");
LOGM(Log::WARN, "requested CWLKeyboardResource::sendEnter without sendLeave first.");
sendLeave();
}
@ -531,7 +531,7 @@ void CWLSeatProtocol::bindManager(wl_client* client, void* data, uint32_t ver, u
RESOURCE->m_self = RESOURCE;
LOGM(LOG, "New seat resource bound at {:x}", (uintptr_t)RESOURCE.get());
LOGM(Log::DEBUG, "New seat resource bound at {:x}", (uintptr_t)RESOURCE.get());
m_events.newSeatResource.emit(RESOURCE);
}

View file

@ -87,7 +87,7 @@ CSHMPool::~CSHMPool() {
}
void CSHMPool::resize(size_t size_) {
LOGM(LOG, "Resizing a SHM pool from {} to {}", m_size, size_);
LOGM(Log::DEBUG, "Resizing a SHM pool from {} to {}", m_size, size_);
if (m_data != MAP_FAILED)
munmap(m_data, m_size);
@ -96,13 +96,13 @@ void CSHMPool::resize(size_t size_) {
m_data = mmap(nullptr, m_size, PROT_READ | PROT_WRITE, MAP_SHARED, m_fd.get(), 0);
if UNLIKELY (m_data == MAP_FAILED)
LOGM(ERR, "Couldn't mmap {} bytes from fd {} of shm client", m_size, m_fd.get());
LOGM(Log::ERR, "Couldn't mmap {} bytes from fd {} of shm client", m_size, m_fd.get());
}
static int shmIsSizeValid(CFileDescriptor& fd, size_t size) {
struct stat st;
if UNLIKELY (fstat(fd.get(), &st) == -1) {
LOGM(ERR, "Couldn't get stat for fd {} of shm client", fd.get());
LOGM(Log::ERR, "Couldn't get stat for fd {} of shm client", fd.get());
return 0;
}

View file

@ -186,7 +186,7 @@ CWLSubcompositorResource::CWLSubcompositorResource(SP<CWlSubcompositor> resource
SURF->m_role = makeShared<CSubsurfaceRole>(RESOURCE);
PARENT->m_subsurfaces.emplace_back(RESOURCE);
LOGM(LOG, "New wl_subsurface with id {} at {:x}", id, (uintptr_t)RESOURCE.get());
LOGM(Log::DEBUG, "New wl_subsurface with id {} at {:x}", id, (uintptr_t)RESOURCE.get());
PARENT->m_events.newSubsurface.emit(RESOURCE);
});