summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorVaxry <43317083+vaxerski@users.noreply.github.com>2025-12-18 17:23:24 +0000
committerGitHub <noreply@github.com>2025-12-18 17:23:24 +0000
commit6175ecd4c4ba817c4620f66a75e1e11da7c7a8ca (patch)
treecf73852f1fc08b1dcee5a3a7380f914aaad9c50a /src
parentf88deb928a0f7dc02f427473f8c29e8f2bed14a3 (diff)
debug: move to hyprutils' logger (#12673)
Diffstat (limited to 'src')
-rw-r--r--src/Compositor.cpp269
-rw-r--r--src/config/ConfigDataValues.hpp2
-rw-r--r--src/config/ConfigManager.cpp118
-rw-r--r--src/config/ConfigWatcher.cpp12
-rw-r--r--src/debug/HyprCtl.cpp43
-rw-r--r--src/debug/Log.cpp78
-rw-r--r--src/debug/Log.hpp75
-rw-r--r--src/debug/TracyDefines.hpp2
-rw-r--r--src/debug/crash/CrashReporter.cpp2
-rw-r--r--src/debug/log/Logger.cpp64
-rw-r--r--src/debug/log/Logger.hpp61
-rw-r--r--src/debug/log/RollingLogFollow.hpp (renamed from src/debug/RollingLogFollow.hpp)14
-rw-r--r--src/defines.hpp2
-rw-r--r--src/desktop/Workspace.cpp40
-rw-r--r--src/desktop/rule/Rule.cpp4
-rw-r--r--src/desktop/rule/layerRule/LayerRule.cpp4
-rw-r--r--src/desktop/rule/layerRule/LayerRuleApplicator.cpp8
-rw-r--r--src/desktop/rule/matchEngine/IntMatchEngine.cpp4
-rw-r--r--src/desktop/rule/windowRule/WindowRule.cpp2
-rw-r--r--src/desktop/rule/windowRule/WindowRuleApplicator.cpp38
-rw-r--r--src/desktop/state/FocusState.cpp18
-rw-r--r--src/desktop/view/LayerSurface.cpp20
-rw-r--r--src/desktop/view/Popup.cpp18
-rw-r--r--src/desktop/view/Subsurface.cpp2
-rw-r--r--src/desktop/view/WLSurface.cpp4
-rw-r--r--src/desktop/view/Window.cpp65
-rw-r--r--src/devices/IKeyboard.cpp38
-rw-r--r--src/helpers/AsyncDialogBox.cpp14
-rw-r--r--src/helpers/Format.cpp2
-rw-r--r--src/helpers/MiscFunctions.cpp44
-rw-r--r--src/helpers/MiscFunctions.hpp1
-rw-r--r--src/helpers/Monitor.cpp132
-rw-r--r--src/helpers/MonitorFrameScheduler.cpp14
-rw-r--r--src/helpers/env/Env.cpp19
-rw-r--r--src/helpers/env/Env.hpp8
-rw-r--r--src/helpers/fs/FsUtils.cpp17
-rw-r--r--src/helpers/math/Expression.cpp4
-rw-r--r--src/helpers/sync/SyncReleaser.cpp2
-rw-r--r--src/helpers/sync/SyncTimeline.cpp28
-rw-r--r--src/init/initHelpers.cpp6
-rw-r--r--src/layout/DwindleLayout.cpp12
-rw-r--r--src/layout/IHyprLayout.cpp16
-rw-r--r--src/layout/MasterLayout.cpp6
-rw-r--r--src/macros.hpp14
-rw-r--r--src/main.cpp13
-rw-r--r--src/managers/ANRManager.cpp8
-rw-r--r--src/managers/CursorManager.cpp12
-rw-r--r--src/managers/DonationNagManager.cpp14
-rw-r--r--src/managers/EventManager.cpp20
-rw-r--r--src/managers/HookSystemManager.cpp4
-rw-r--r--src/managers/KeybindManager.cpp164
-rw-r--r--src/managers/LayoutManager.cpp6
-rw-r--r--src/managers/PointerManager.cpp44
-rw-r--r--src/managers/ProtocolManager.cpp8
-rw-r--r--src/managers/SeatManager.cpp16
-rw-r--r--src/managers/SessionLockManager.cpp6
-rw-r--r--src/managers/VersionKeeperManager.cpp8
-rw-r--r--src/managers/WelcomeManager.cpp6
-rw-r--r--src/managers/XCursorManager.cpp39
-rw-r--r--src/managers/XWaylandManager.cpp4
-rw-r--r--src/managers/animation/DesktopAnimationManager.cpp2
-rw-r--r--src/managers/eventLoop/EventLoopManager.cpp6
-rw-r--r--src/managers/input/IdleInhibitor.cpp4
-rw-r--r--src/managers/input/InputManager.cpp99
-rw-r--r--src/managers/input/InputMethodPopup.cpp10
-rw-r--r--src/managers/input/InputMethodRelay.cpp8
-rw-r--r--src/managers/input/Tablets.cpp6
-rw-r--r--src/managers/input/TextInput.cpp18
-rw-r--r--src/managers/input/Touch.cpp4
-rw-r--r--src/managers/input/UnifiedWorkspaceSwipeGesture.cpp6
-rw-r--r--src/managers/input/trackpad/TrackpadGestures.cpp8
-rw-r--r--src/managers/permissions/DynamicPermissionManager.cpp56
-rw-r--r--src/plugins/HookSystem.cpp28
-rw-r--r--src/plugins/PluginAPI.cpp6
-rw-r--r--src/plugins/PluginSystem.cpp34
-rw-r--r--src/protocols/AlphaModifier.cpp2
-rw-r--r--src/protocols/CTMControl.cpp6
-rw-r--r--src/protocols/ColorManagement.cpp68
-rw-r--r--src/protocols/ContentType.cpp4
-rw-r--r--src/protocols/DRMLease.cpp22
-rw-r--r--src/protocols/DRMSyncobj.cpp10
-rw-r--r--src/protocols/DataDeviceWlr.cpp36
-rw-r--r--src/protocols/ExtDataDevice.cpp36
-rw-r--r--src/protocols/ExtWorkspace.cpp6
-rw-r--r--src/protocols/Fifo.cpp2
-rw-r--r--src/protocols/FocusGrab.cpp2
-rw-r--r--src/protocols/ForeignToplevel.cpp8
-rw-r--r--src/protocols/ForeignToplevelWlr.cpp8
-rw-r--r--src/protocols/FractionalScale.cpp2
-rw-r--r--src/protocols/FrogColorManagement.cpp27
-rw-r--r--src/protocols/GammaControl.cpp22
-rw-r--r--src/protocols/HyprlandSurface.cpp2
-rw-r--r--src/protocols/IdleNotify.cpp2
-rw-r--r--src/protocols/InputMethodV2.cpp12
-rw-r--r--src/protocols/LayerShell.cpp2
-rw-r--r--src/protocols/LinuxDMABUF.cpp40
-rw-r--r--src/protocols/LockNotify.cpp4
-rw-r--r--src/protocols/MesaDRM.cpp12
-rw-r--r--src/protocols/OutputManagement.cpp80
-rw-r--r--src/protocols/PointerConstraints.cpp6
-rw-r--r--src/protocols/PointerGestures.cpp6
-rw-r--r--src/protocols/PointerWarp.cpp2
-rw-r--r--src/protocols/PresentationTime.cpp2
-rw-r--r--src/protocols/PrimarySelection.cpp36
-rw-r--r--src/protocols/Screencopy.cpp44
-rw-r--r--src/protocols/SecurityContext.cpp22
-rw-r--r--src/protocols/SessionLock.cpp14
-rw-r--r--src/protocols/ShortcutsInhibit.cpp2
-rw-r--r--src/protocols/SinglePixel.cpp4
-rw-r--r--src/protocols/Tablet.cpp12
-rw-r--r--src/protocols/TextInputV1.cpp6
-rw-r--r--src/protocols/TextInputV3.cpp4
-rw-r--r--src/protocols/ToplevelExport.cpp20
-rw-r--r--src/protocols/ToplevelMapping.cpp6
-rw-r--r--src/protocols/VirtualKeyboard.cpp8
-rw-r--r--src/protocols/VirtualPointer.cpp2
-rw-r--r--src/protocols/WaylandProtocol.cpp4
-rw-r--r--src/protocols/WaylandProtocol.hpp9
-rw-r--r--src/protocols/XDGActivation.cpp8
-rw-r--r--src/protocols/XDGDecoration.cpp4
-rw-r--r--src/protocols/XDGOutput.cpp8
-rw-r--r--src/protocols/XDGShell.cpp26
-rw-r--r--src/protocols/XXColorManagement.cpp64
-rw-r--r--src/protocols/core/Compositor.cpp14
-rw-r--r--src/protocols/core/DataDevice.cpp72
-rw-r--r--src/protocols/core/Output.cpp2
-rw-r--r--src/protocols/core/Seat.cpp14
-rw-r--r--src/protocols/core/Shm.cpp6
-rw-r--r--src/protocols/core/Subcompositor.cpp2
-rw-r--r--src/protocols/types/Buffer.cpp2
-rw-r--r--src/protocols/types/DMABuffer.cpp6
-rw-r--r--src/render/Framebuffer.cpp2
-rw-r--r--src/render/OpenGL.cpp139
-rw-r--r--src/render/Renderbuffer.cpp4
-rw-r--r--src/render/Renderer.cpp86
-rw-r--r--src/render/Texture.cpp6
-rw-r--r--src/render/decorations/DecorationPositioner.cpp6
-rw-r--r--src/render/pass/FramebufferElement.cpp4
-rw-r--r--src/render/pass/SurfacePassElement.cpp2
-rw-r--r--src/xwayland/Dnd.cpp12
-rw-r--r--src/xwayland/Server.cpp60
-rw-r--r--src/xwayland/XDataSource.cpp10
-rw-r--r--src/xwayland/XSurface.cpp12
-rw-r--r--src/xwayland/XWM.cpp177
-rw-r--r--src/xwayland/XWM.hpp4
-rw-r--r--src/xwayland/XWayland.cpp14
146 files changed, 1695 insertions, 1708 deletions
diff --git a/src/Compositor.cpp b/src/Compositor.cpp
index f4e92ee9..7b5e0324 100644
--- a/src/Compositor.cpp
+++ b/src/Compositor.cpp
@@ -2,7 +2,7 @@
#include <re2/re2.h>
#include "Compositor.hpp"
-#include "debug/Log.hpp"
+#include "debug/log/Logger.hpp"
#include "desktop/DesktopTypes.hpp"
#include "desktop/state/FocusState.hpp"
#include "helpers/Splashes.hpp"
@@ -32,6 +32,7 @@
#include <helpers/SdDaemon.hpp> // for SdNotify
#endif
#include "helpers/fs/FsUtils.hpp"
+#include "helpers/env/Env.hpp"
#include "protocols/FractionalScale.hpp"
#include "protocols/PointerConstraints.hpp"
#include "protocols/LayerShell.hpp"
@@ -86,7 +87,7 @@ using enum NContentType::eContentType;
using namespace NColorManagement;
static int handleCritSignal(int signo, void* data) {
- Debug::log(LOG, "Hyprland received signal {}", signo);
+ Log::logger->log(Log::DEBUG, "Hyprland received signal {}", signo);
if (signo == SIGTERM || signo == SIGINT || signo == SIGKILL)
g_pCompositor->stopCompositor();
@@ -125,23 +126,6 @@ static void handleUserSignal(int sig) {
}
}
-static eLogLevel aqLevelToHl(Aquamarine::eBackendLogLevel level) {
- switch (level) {
- case Aquamarine::eBackendLogLevel::AQ_LOG_TRACE: return TRACE;
- case Aquamarine::eBackendLogLevel::AQ_LOG_DEBUG: return LOG;
- case Aquamarine::eBackendLogLevel::AQ_LOG_ERROR: return ERR;
- case Aquamarine::eBackendLogLevel::AQ_LOG_WARNING: return WARN;
- case Aquamarine::eBackendLogLevel::AQ_LOG_CRITICAL: return CRIT;
- default: break;
- }
-
- return NONE;
-}
-
-static void aqLog(Aquamarine::eBackendLogLevel level, std::string msg) {
- Debug::log(aqLevelToHl(level), "[AQ] {}", msg);
-}
-
bool CCompositor::setWatchdogFd(int fd) {
m_watchdogWriteFd = Hyprutils::OS::CFileDescriptor{fd};
return m_watchdogWriteFd.isValid() && !m_watchdogWriteFd.isClosed();
@@ -149,9 +133,9 @@ bool CCompositor::setWatchdogFd(int fd) {
void CCompositor::bumpNofile() {
if (!getrlimit(RLIMIT_NOFILE, &m_originalNofile))
- Debug::log(LOG, "Old rlimit: soft -> {}, hard -> {}", m_originalNofile.rlim_cur, m_originalNofile.rlim_max);
+ Log::logger->log(Log::DEBUG, "Old rlimit: soft -> {}, hard -> {}", m_originalNofile.rlim_cur, m_originalNofile.rlim_max);
else {
- Debug::log(ERR, "Failed to get NOFILE rlimits");
+ Log::logger->log(Log::ERR, "Failed to get NOFILE rlimits");
m_originalNofile.rlim_max = 0;
return;
}
@@ -161,13 +145,13 @@ void CCompositor::bumpNofile() {
newLimit.rlim_cur = newLimit.rlim_max;
if (setrlimit(RLIMIT_NOFILE, &newLimit) < 0) {
- Debug::log(ERR, "Failed bumping NOFILE limits higher");
+ Log::logger->log(Log::ERR, "Failed bumping NOFILE limits higher");
m_originalNofile.rlim_max = 0;
return;
}
if (!getrlimit(RLIMIT_NOFILE, &newLimit))
- Debug::log(LOG, "New rlimit: soft -> {}, hard -> {}", newLimit.rlim_cur, newLimit.rlim_max);
+ Log::logger->log(Log::DEBUG, "New rlimit: soft -> {}, hard -> {}", newLimit.rlim_cur, newLimit.rlim_max);
}
void CCompositor::restoreNofile() {
@@ -175,7 +159,7 @@ void CCompositor::restoreNofile() {
return;
if (setrlimit(RLIMIT_NOFILE, &m_originalNofile) < 0)
- Debug::log(ERR, "Failed restoring NOFILE limits");
+ Log::logger->log(Log::ERR, "Failed restoring NOFILE limits");
}
bool CCompositor::supportsDrmSyncobjTimeline() const {
@@ -235,27 +219,27 @@ CCompositor::CCompositor(bool onlyConfig) : m_onlyConfigVerification(onlyConfig)
throw std::runtime_error("CCompositor() failed");
}
- Debug::init(m_instancePath);
+ Log::logger->initIS(m_instancePath);
- Debug::log(LOG, "Instance Signature: {}", m_instanceSignature);
+ Log::logger->log(Log::DEBUG, "Instance Signature: {}", m_instanceSignature);
- Debug::log(LOG, "Runtime directory: {}", m_instancePath);
+ Log::logger->log(Log::DEBUG, "Runtime directory: {}", m_instancePath);
- Debug::log(LOG, "Hyprland PID: {}", m_hyprlandPID);
+ Log::logger->log(Log::DEBUG, "Hyprland PID: {}", m_hyprlandPID);
- Debug::log(LOG, "===== SYSTEM INFO: =====");
+ Log::logger->log(Log::DEBUG, "===== SYSTEM INFO: =====");
logSystemInfo();
- Debug::log(LOG, "========================");
+ Log::logger->log(Log::DEBUG, "========================");
- Debug::log(NONE, "\n\n"); // pad
+ Log::logger->log(Log::DEBUG, "\n\n"); // pad
- Debug::log(INFO, "If you are crashing, or encounter any bugs, please consult https://wiki.hypr.land/Crashes-and-Bugs/\n\n");
+ Log::logger->log(Log::INFO, "If you are crashing, or encounter any bugs, please consult https://wiki.hypr.land/Crashes-and-Bugs/\n\n");
setRandomSplash();
- Debug::log(LOG, "\nCurrent splash: {}\n\n", m_currentSplash);
+ Log::logger->log(Log::DEBUG, "\nCurrent splash: {}\n\n", m_currentSplash);
bumpNofile();
}
@@ -315,7 +299,7 @@ void CCompositor::initServer(std::string socketName, int socketFd) {
// register crit signal handler
m_critSigSource = wl_event_loop_add_signal(m_wlEventLoop, SIGTERM, handleCritSignal, nullptr);
- if (!envEnabled("HYPRLAND_NO_CRASHREPORTER")) {
+ if (!Env::envEnabled("HYPRLAND_NO_CRASHREPORTER")) {
signal(SIGSEGV, handleUnrecoverableSignal);
signal(SIGABRT, handleUnrecoverableSignal);
}
@@ -323,14 +307,16 @@ void CCompositor::initServer(std::string socketName, int socketFd) {
initManagers(STAGE_PRIORITY);
- if (envEnabled("HYPRLAND_TRACE"))
- Debug::m_trace = true;
+ Log::logger->initCallbacks();
// set the buffer size to 1MB to avoid disconnects due to an app hanging for a short while
wl_display_set_default_max_buffer_size(m_wlDisplay, 1_MB);
- Aquamarine::SBackendOptions options{};
- options.logFunction = aqLog;
+ Aquamarine::SBackendOptions options{};
+ SP<Hyprutils::CLI::CLoggerConnection> conn = makeShared<Hyprutils::CLI::CLoggerConnection>(Log::logger->hu());
+ conn->setLogLevel(Log::DEBUG);
+ conn->setName("aquamarine");
+ options.logConnection = std::move(conn);
std::vector<Aquamarine::SBackendImplementationOptions> implementations;
Aquamarine::SBackendImplementationOptions option;
@@ -347,9 +333,10 @@ void CCompositor::initServer(std::string socketName, int socketFd) {
m_aqBackend = CBackend::create(implementations, options);
if (!m_aqBackend) {
- Debug::log(CRIT,
- "m_pAqBackend was null! This usually means aquamarine could not find a GPU or encountered some issues. Make sure you're running either on a tty or on a Wayland "
- "session, NOT an X11 one.");
+ Log::logger->log(
+ Log::CRIT,
+ "m_pAqBackend was null! This usually means aquamarine could not find a GPU or encountered some issues. Make sure you're running either on a tty or on a Wayland "
+ "session, NOT an X11 one.");
throwError("CBackend::create() failed!");
}
@@ -358,19 +345,20 @@ void CCompositor::initServer(std::string socketName, int socketFd) {
initAllSignals();
if (!m_aqBackend->start()) {
- Debug::log(CRIT,
- "m_pAqBackend couldn't start! This usually means aquamarine could not find a GPU or encountered some issues. Make sure you're running either on a tty or on a "
- "Wayland session, NOT an X11 one.");
+ Log::logger->log(
+ Log::CRIT,
+ "m_pAqBackend couldn't start! This usually means aquamarine could not find a GPU or encountered some issues. Make sure you're running either on a tty or on a "
+ "Wayland session, NOT an X11 one.");
throwError("CBackend::create() failed!");
}
m_initialized = true;
m_drm.fd = m_aqBackend->drmFD();
- Debug::log(LOG, "Running on DRMFD: {}", m_drm.fd);
+ Log::logger->log(Log::DEBUG, "Running on DRMFD: {}", m_drm.fd);
m_drmRenderNode.fd = m_aqBackend->drmRenderNodeFD();
- Debug::log(LOG, "Using RENDERNODEFD: {}", m_drmRenderNode.fd);
+ Log::logger->log(Log::DEBUG, "Using RENDERNODEFD: {}", m_drmRenderNode.fd);
#if defined(__linux__)
auto syncObjSupport = [](auto fd) {
@@ -383,15 +371,15 @@ void CCompositor::initServer(std::string socketName, int socketFd) {
};
if ((m_drm.syncobjSupport = syncObjSupport(m_drm.fd)))
- Debug::log(LOG, "DRM DisplayNode syncobj timeline support: {}", m_drm.syncobjSupport ? "yes" : "no");
+ Log::logger->log(Log::DEBUG, "DRM DisplayNode syncobj timeline support: {}", m_drm.syncobjSupport ? "yes" : "no");
if ((m_drmRenderNode.syncObjSupport = syncObjSupport(m_drmRenderNode.fd)))
- Debug::log(LOG, "DRM RenderNode syncobj timeline support: {}", m_drmRenderNode.syncObjSupport ? "yes" : "no");
+ Log::logger->log(Log::DEBUG, "DRM RenderNode syncobj timeline support: {}", m_drmRenderNode.syncObjSupport ? "yes" : "no");
if (!m_drm.syncobjSupport && !m_drmRenderNode.syncObjSupport)
- Debug::log(LOG, "DRM no syncobj support, disabling explicit sync");
+ Log::logger->log(Log::DEBUG, "DRM no syncobj support, disabling explicit sync");
#else
- Debug::log(LOG, "DRM syncobj timeline support: no (not linux)");
+ Log::logger->log(Log::DEBUG, "DRM syncobj timeline support: no (not linux)");
#endif
if (!socketName.empty() && socketFd != -1) {
@@ -399,9 +387,9 @@ void CCompositor::initServer(std::string socketName, int socketFd) {
const auto RETVAL = wl_display_add_socket_fd(m_wlDisplay, socketFd);
if (RETVAL >= 0) {
m_wlDisplaySocket = socketName;
- Debug::log(LOG, "wl_display_add_socket_fd for {} succeeded with {}", socketName, RETVAL);
+ Log::logger->log(Log::DEBUG, "wl_display_add_socket_fd for {} succeeded with {}", socketName, RETVAL);
} else
- Debug::log(WARN, "wl_display_add_socket_fd for {} returned {}: skipping", socketName, RETVAL);
+ Log::logger->log(Log::WARN, "wl_display_add_socket_fd for {} returned {}: skipping", socketName, RETVAL);
} else {
// get socket, avoid using 0
for (int candidate = 1; candidate <= 32; candidate++) {
@@ -409,22 +397,22 @@ void CCompositor::initServer(std::string socketName, int socketFd) {
const auto RETVAL = wl_display_add_socket(m_wlDisplay, CANDIDATESTR.c_str());
if (RETVAL >= 0) {
m_wlDisplaySocket = CANDIDATESTR;
- Debug::log(LOG, "wl_display_add_socket for {} succeeded with {}", CANDIDATESTR, RETVAL);
+ Log::logger->log(Log::DEBUG, "wl_display_add_socket for {} succeeded with {}", CANDIDATESTR, RETVAL);
break;
} else
- Debug::log(WARN, "wl_display_add_socket for {} returned {}: skipping candidate {}", CANDIDATESTR, RETVAL, candidate);
+ Log::logger->log(Log::WARN, "wl_display_add_socket for {} returned {}: skipping candidate {}", CANDIDATESTR, RETVAL, candidate);
}
}
if (m_wlDisplaySocket.empty()) {
- Debug::log(WARN, "All candidates failed, trying wl_display_add_socket_auto");
+ Log::logger->log(Log::WARN, "All candidates failed, trying wl_display_add_socket_auto");
const auto SOCKETSTR = wl_display_add_socket_auto(m_wlDisplay);
if (SOCKETSTR)
m_wlDisplaySocket = SOCKETSTR;
}
if (m_wlDisplaySocket.empty()) {
- Debug::log(CRIT, "m_szWLDisplaySocket NULL!");
+ Log::logger->log(Log::CRIT, "m_szWLDisplaySocket NULL!");
throwError("m_szWLDisplaySocket was null! (wl_display_add_socket and wl_display_add_socket_auto failed)");
}
@@ -446,7 +434,7 @@ void CCompositor::initServer(std::string socketName, int socketFd) {
void CCompositor::initAllSignals() {
m_aqBackend->events.newOutput.listenStatic([this](const SP<Aquamarine::IOutput>& output) {
- Debug::log(LOG, "New aquamarine output with name {}", output->name);
+ Log::logger->log(Log::DEBUG, "New aquamarine output with name {}", output->name);
if (m_initialized)
onNewMonitor(output);
else
@@ -454,42 +442,42 @@ void CCompositor::initAllSignals() {
});
m_aqBackend->events.newPointer.listenStatic([](const SP<Aquamarine::IPointer>& dev) {
- Debug::log(LOG, "New aquamarine pointer with name {}", dev->getName());
+ Log::logger->log(Log::DEBUG, "New aquamarine pointer with name {}", dev->getName());
g_pInputManager->newMouse(dev);
g_pInputManager->updateCapabilities();
});
m_aqBackend->events.newKeyboard.listenStatic([](const SP<Aquamarine::IKeyboard>& dev) {
- Debug::log(LOG, "New aquamarine keyboard with name {}", dev->getName());
+ Log::logger->log(Log::DEBUG, "New aquamarine keyboard with name {}", dev->getName());
g_pInputManager->newKeyboard(dev);
g_pInputManager->updateCapabilities();
});
m_aqBackend->events.newTouch.listenStatic([](const SP<Aquamarine::ITouch>& dev) {
- Debug::log(LOG, "New aquamarine touch with name {}", dev->getName());
+ Log::logger->log(Log::DEBUG, "New aquamarine touch with name {}", dev->getName());
g_pInputManager->newTouchDevice(dev);
g_pInputManager->updateCapabilities();
});
m_aqBackend->events.newSwitch.listenStatic([](const SP<Aquamarine::ISwitch>& dev) {
- Debug::log(LOG, "New aquamarine switch with name {}", dev->getName());
+ Log::logger->log(Log::DEBUG, "New aquamarine switch with name {}", dev->getName());
g_pInputManager->newSwitch(dev);
});
m_aqBackend->events.newTablet.listenStatic([](const SP<Aquamarine::ITablet>& dev) {
- Debug::log(LOG, "New aquamarine tablet with name {}", dev->getName());
+ Log::logger->log(Log::DEBUG, "New aquamarine tablet with name {}", dev->getName());
g_pInputManager->newTablet(dev);
});
m_aqBackend->events.newTabletPad.listenStatic([](const SP<Aquamarine::ITabletPad>& dev) {
- Debug::log(LOG, "New aquamarine tablet pad with name {}", dev->getName());
+ Log::logger->log(Log::DEBUG, "New aquamarine tablet pad with name {}", dev->getName());
g_pInputManager->newTabletPad(dev);
});
if (m_aqBackend->hasSession()) {
m_aqBackend->session->events.changeActive.listenStatic([this] {
if (m_aqBackend->session->active) {
- Debug::log(LOG, "Session got activated!");
+ Log::logger->log(Log::DEBUG, "Session got activated!");
m_sessionActive = true;
@@ -501,7 +489,7 @@ void CCompositor::initAllSignals() {
g_pConfigManager->m_wantsMonitorReload = true;
g_pCursorManager->syncGsettings();
} else {
- Debug::log(LOG, "Session got deactivated!");
+ Log::logger->log(Log::DEBUG, "Session got deactivated!");
m_sessionActive = false;
}
@@ -525,7 +513,7 @@ void CCompositor::cleanEnvironment() {
if (m_desktopEnvSet)
unsetenv("XDG_CURRENT_DESKTOP");
- if (m_aqBackend->hasSession() && !envEnabled("HYPRLAND_NO_SD_VARS")) {
+ if (m_aqBackend->hasSession() && !Env::envEnabled("HYPRLAND_NO_SD_VARS")) {
const auto CMD =
#ifdef USES_SYSTEMD
"systemctl --user unset-environment DISPLAY WAYLAND_DISPLAY HYPRLAND_INSTANCE_SIGNATURE XDG_CURRENT_DESKTOP QT_QPA_PLATFORMTHEME PATH XDG_DATA_DIRS && hash "
@@ -537,7 +525,7 @@ void CCompositor::cleanEnvironment() {
}
void CCompositor::stopCompositor() {
- Debug::log(LOG, "Hyprland is stopping!");
+ Log::logger->log(Log::DEBUG, "Hyprland is stopping!");
// this stops the wayland loop, wl_display_run
wl_display_terminate(m_wlDisplay);
@@ -556,11 +544,10 @@ void CCompositor::cleanup() {
removeLockFile();
- m_isShuttingDown = true;
- Debug::m_shuttingDown = true;
+ m_isShuttingDown = true;
#ifdef USES_SYSTEMD
- if (NSystemd::sdBooted() > 0 && !envEnabled("HYPRLAND_NO_SD_NOTIFY"))
+ if (NSystemd::sdBooted() > 0 && !Env::envEnabled("HYPRLAND_NO_SD_NOTIFY"))
NSystemd::sdNotify(0, "STOPPING=1");
#endif
@@ -622,106 +609,104 @@ void CCompositor::cleanup() {
// this frees all wayland resources, including sockets
wl_display_destroy(m_wlDisplay);
-
- Debug::close();
}
void CCompositor::initManagers(eManagersInitStage stage) {
switch (stage) {
case STAGE_PRIORITY: {
- Debug::log(LOG, "Creating the EventLoopManager!");
+ Log::logger->log(Log::DEBUG, "Creating the EventLoopManager!");
g_pEventLoopManager = makeUnique<CEventLoopManager>(m_wlDisplay, m_wlEventLoop);
- Debug::log(LOG, "Creating the HookSystem!");
+ Log::logger->log(Log::DEBUG, "Creating the HookSystem!");
g_pHookSystem = makeUnique<CHookSystemManager>();
- Debug::log(LOG, "Creating the KeybindManager!");
+ Log::logger->log(Log::DEBUG, "Creating the KeybindManager!");
g_pKeybindManager = makeUnique<CKeybindManager>();
- Debug::log(LOG, "Creating the AnimationManager!");
+ Log::logger->log(Log::DEBUG, "Creating the AnimationManager!");
g_pAnimationManager = makeUnique<CHyprAnimationManager>();
- Debug::log(LOG, "Creating the DynamicPermissionManager!");
+ Log::logger->log(Log::DEBUG, "Creating the DynamicPermissionManager!");
g_pDynamicPermissionManager = makeUnique<CDynamicPermissionManager>();
- Debug::log(LOG, "Creating the ConfigManager!");
+ Log::logger->log(Log::DEBUG, "Creating the ConfigManager!");
g_pConfigManager = makeUnique<CConfigManager>();
- Debug::log(LOG, "Creating the CHyprError!");
+ Log::logger->log(Log::DEBUG, "Creating the CHyprError!");
g_pHyprError = makeUnique<CHyprError>();
- Debug::log(LOG, "Creating the LayoutManager!");
+ Log::logger->log(Log::DEBUG, "Creating the LayoutManager!");
g_pLayoutManager = makeUnique<CLayoutManager>();
- Debug::log(LOG, "Creating the TokenManager!");
+ Log::logger->log(Log::DEBUG, "Creating the TokenManager!");
g_pTokenManager = makeUnique<CTokenManager>();
g_pConfigManager->init();
- Debug::log(LOG, "Creating the PointerManager!");
+ Log::logger->log(Log::DEBUG, "Creating the PointerManager!");
g_pPointerManager = makeUnique<CPointerManager>();
- Debug::log(LOG, "Creating the EventManager!");
+ Log::logger->log(Log::DEBUG, "Creating the EventManager!");
g_pEventManager = makeUnique<CEventManager>();
- Debug::log(LOG, "Creating the AsyncResourceGatherer!");
+ Log::logger->log(Log::DEBUG, "Creating the AsyncResourceGatherer!");
g_pAsyncResourceGatherer = makeUnique<Hyprgraphics::CAsyncResourceGatherer>();
} break;
case STAGE_BASICINIT: {
- Debug::log(LOG, "Creating the CHyprOpenGLImpl!");
+ Log::logger->log(Log::DEBUG, "Creating the CHyprOpenGLImpl!");
g_pHyprOpenGL = makeUnique<CHyprOpenGLImpl>();
- Debug::log(LOG, "Creating the ProtocolManager!");
+ Log::logger->log(Log::DEBUG, "Creating the ProtocolManager!");
g_pProtocolManager = makeUnique<CProtocolManager>();
- Debug::log(LOG, "Creating the SeatManager!");
+ Log::logger->log(Log::DEBUG, "Creating the SeatManager!");
g_pSeatManager = makeUnique<CSeatManager>();
} break;
case STAGE_LATE: {
- Debug::log(LOG, "Creating CHyprCtl");
+ Log::logger->log(Log::DEBUG, "Creating CHyprCtl");
g_pHyprCtl = makeUnique<CHyprCtl>();
- Debug::log(LOG, "Creating the InputManager!");
+ Log::logger->log(Log::DEBUG, "Creating the InputManager!");
g_pInputManager = makeUnique<CInputManager>();
- Debug::log(LOG, "Creating the HyprRenderer!");
+ Log::logger->log(Log::DEBUG, "Creating the HyprRenderer!");
g_pHyprRenderer = makeUnique<CHyprRenderer>();
- Debug::log(LOG, "Creating the XWaylandManager!");
+ Log::logger->log(Log::DEBUG, "Creating the XWaylandManager!");
g_pXWaylandManager = makeUnique<CHyprXWaylandManager>();
- Debug::log(LOG, "Creating the SessionLockManager!");
+ Log::logger->log(Log::DEBUG, "Creating the SessionLockManager!");
g_pSessionLockManager = makeUnique<CSessionLockManager>();
- Debug::log(LOG, "Creating the HyprDebugOverlay!");
+ Log::logger->log(Log::DEBUG, "Creating the HyprDebugOverlay!");
g_pDebugOverlay = makeUnique<CHyprDebugOverlay>();
- Debug::log(LOG, "Creating the HyprNotificationOverlay!");
+ Log::logger->log(Log::DEBUG, "Creating the HyprNotificationOverlay!");
g_pHyprNotificationOverlay = makeUnique<CHyprNotificationOverlay>();
- Debug::log(LOG, "Creating the PluginSystem!");
+ Log::logger->log(Log::DEBUG, "Creating the PluginSystem!");
g_pPluginSystem = makeUnique<CPluginSystem>();
g_pConfigManager->handlePluginLoads();
- Debug::log(LOG, "Creating the DecorationPositioner!");
+ Log::logger->log(Log::DEBUG, "Creating the DecorationPositioner!");
g_pDecorationPositioner = makeUnique<CDecorationPositioner>();
- Debug::log(LOG, "Creating the CursorManager!");
+ Log::logger->log(Log::DEBUG, "Creating the CursorManager!");
g_pCursorManager = makeUnique<CCursorManager>();
- Debug::log(LOG, "Creating the VersionKeeper!");
+ Log::logger->log(Log::DEBUG, "Creating the VersionKeeper!");
g_pVersionKeeperMgr = makeUnique<CVersionKeeperManager>();
- Debug::log(LOG, "Creating the DonationNag!");
+ Log::logger->log(Log::DEBUG, "Creating the DonationNag!");
g_pDonationNagManager = makeUnique<CDonationNagManager>();
- Debug::log(LOG, "Creating the WelcomeManager!");
+ Log::logger->log(Log::DEBUG, "Creating the WelcomeManager!");
g_pWelcomeManager = makeUnique<CWelcomeManager>();
- Debug::log(LOG, "Creating the ANRManager!");
+ Log::logger->log(Log::DEBUG, "Creating the ANRManager!");
g_pANRManager = makeUnique<CANRManager>();
- Debug::log(LOG, "Starting XWayland");
+ Log::logger->log(Log::DEBUG, "Starting XWayland");
g_pXWayland = makeUnique<CXWayland>(g_pCompositor->m_wantsXwayland);
} break;
default: UNREACHABLE();
@@ -756,7 +741,7 @@ void CCompositor::prepareFallbackOutput() {
}
if (!headless) {
- Debug::log(WARN, "No headless in prepareFallbackOutput?!");
+ Log::logger->log(Log::WARN, "No headless in prepareFallbackOutput?!");
return;
}
@@ -773,7 +758,7 @@ void CCompositor::startCompositor() {
/* Session-less Hyprland usually means a nest, don't update the env in that case */
m_aqBackend->hasSession() &&
/* Activation environment management is not disabled */
- !envEnabled("HYPRLAND_NO_SD_VARS")) {
+ !Env::envEnabled("HYPRLAND_NO_SD_VARS")) {
const auto CMD =
#ifdef USES_SYSTEMD
"systemctl --user import-environment DISPLAY WAYLAND_DISPLAY HYPRLAND_INSTANCE_SIGNATURE XDG_CURRENT_DESKTOP QT_QPA_PLATFORMTHEME PATH XDG_DATA_DIRS && hash "
@@ -783,7 +768,7 @@ void CCompositor::startCompositor() {
CKeybindManager::spawn(CMD);
}
- Debug::log(LOG, "Running on WAYLAND_DISPLAY: {}", m_wlDisplaySocket);
+ Log::logger->log(Log::DEBUG, "Running on WAYLAND_DISPLAY: {}", m_wlDisplaySocket);
prepareFallbackOutput();
@@ -792,10 +777,10 @@ void CCompositor::startCompositor() {
#ifdef USES_SYSTEMD
if (NSystemd::sdBooted() > 0) {
// tell systemd that we are ready so it can start other bond, following, related units
- if (!envEnabled("HYPRLAND_NO_SD_NOTIFY"))
+ if (!Env::envEnabled("HYPRLAND_NO_SD_NOTIFY"))
NSystemd::sdNotify(0, "READY=1");
} else
- Debug::log(LOG, "systemd integration is baked in but system itself is not booted à la systemd!");
+ Log::logger->log(Log::DEBUG, "systemd integration is baked in but system itself is not booted à la systemd!");
#endif
createLockFile();
@@ -805,7 +790,7 @@ void CCompositor::startCompositor() {
write(m_watchdogWriteFd.get(), "vax", 3);
// This blocks until we are done.
- Debug::log(LOG, "Hyprland is ready, running the event loop!");
+ Log::logger->log(Log::DEBUG, "Hyprland is ready, running the event loop!");
g_pEventLoopManager->enterLoop();
}
@@ -842,7 +827,7 @@ PHLMONITOR CCompositor::getMonitorFromCursor() {
PHLMONITOR CCompositor::getMonitorFromVector(const Vector2D& point) {
if (m_monitors.empty()) {
- Debug::log(WARN, "getMonitorFromVector called with empty monitor list");
+ Log::logger->log(Log::WARN, "getMonitorFromVector called with empty monitor list");
return nullptr;
}
@@ -868,7 +853,7 @@ PHLMONITOR CCompositor::getMonitorFromVector(const Vector2D& point) {
}
if (!pBestMon) { // ?????
- Debug::log(WARN, "getMonitorFromVector no close mon???");
+ Log::logger->log(Log::WARN, "getMonitorFromVector no close mon???");
return m_monitors.front();
}
@@ -1310,7 +1295,7 @@ void CCompositor::cleanupFadingOut(const MONITORID& monid) {
w.reset();
- Debug::log(LOG, "Cleanup: destroyed a window");
+ Log::logger->log(Log::DEBUG, "Cleanup: destroyed a window");
return;
}
}
@@ -1347,7 +1332,7 @@ void CCompositor::cleanupFadingOut(const MONITORID& monid) {
ls.reset();
- Debug::log(LOG, "Cleanup: destroyed a layersurface");
+ Log::logger->log(Log::DEBUG, "Cleanup: destroyed a layersurface");
return;
}
@@ -1621,7 +1606,7 @@ PHLWORKSPACE CCompositor::getWorkspaceByString(const std::string& str) {
try {
return getWorkspaceByID(getWorkspaceIDNameFromString(str).id);
- } catch (std::exception& e) { Debug::log(ERR, "Error in getWorkspaceByString, invalid id"); }
+ } catch (std::exception& e) { Log::logger->log(Log::ERR, "Error in getWorkspaceByString, invalid id"); }
return nullptr;
}
@@ -1871,7 +1856,7 @@ PHLMONITOR CCompositor::getMonitorFromString(const std::string& name) {
const auto OFFSET = name[0] == '-' ? name : name.substr(1);
if (!isNumber(OFFSET)) {
- Debug::log(ERR, "Error in getMonitorFromString: Not a number in relative.");
+ Log::logger->log(Log::ERR, "Error in getMonitorFromString: Not a number in relative.");
return nullptr;
}
@@ -1895,7 +1880,7 @@ PHLMONITOR CCompositor::getMonitorFromString(const std::string& name) {
}
if (currentPlace != std::clamp(currentPlace, 0, sc<int>(m_monitors.size()) - 1)) {
- Debug::log(WARN, "Error in getMonitorFromString: Vaxry's code sucks.");
+ Log::logger->log(Log::WARN, "Error in getMonitorFromString: Vaxry's code sucks.");
currentPlace = std::clamp(currentPlace, 0, sc<int>(m_monitors.size()) - 1);
}
@@ -1907,14 +1892,14 @@ PHLMONITOR CCompositor::getMonitorFromString(const std::string& name) {
monID = std::stoi(name);
} catch (std::exception& e) {
// shouldn't happen but jic
- Debug::log(ERR, "Error in getMonitorFromString: invalid num");
+ Log::logger->log(Log::ERR, "Error in getMonitorFromString: invalid num");
return nullptr;
}
if (monID > -1 && monID < sc<MONITORID>(m_monitors.size())) {
return getMonitorFromID(monID);
} else {
- Debug::log(ERR, "Error in getMonitorFromString: invalid arg 1");
+ Log::logger->log(Log::ERR, "Error in getMonitorFromString: invalid arg 1");
return nullptr;
}
} else {
@@ -1940,7 +1925,7 @@ void CCompositor::moveWorkspaceToMonitor(PHLWORKSPACE pWorkspace, PHLMONITOR pMo
if (pWorkspace->m_monitor == pMonitor)
return;
- Debug::log(LOG, "moveWorkspaceToMonitor: Moving {} to monitor {}", pWorkspace->m_id, pMonitor->m_id);
+ Log::logger->log(Log::DEBUG, "moveWorkspaceToMonitor: Moving {} to monitor {}", pWorkspace->m_id, pMonitor->m_id);
const auto POLDMON = pWorkspace->m_monitor.lock();
@@ -1969,13 +1954,13 @@ void CCompositor::moveWorkspaceToMonitor(PHLWORKSPACE pWorkspace, PHLMONITOR pMo
}())
nextWorkspaceOnMonitorID++;
- Debug::log(LOG, "moveWorkspaceToMonitor: Plugging gap with new {}", nextWorkspaceOnMonitorID);
+ Log::logger->log(Log::DEBUG, "moveWorkspaceToMonitor: Plugging gap with new {}", nextWorkspaceOnMonitorID);
if (POLDMON)
newWorkspace = g_pCompositor->createNewWorkspace(nextWorkspaceOnMonitorID, POLDMON->m_id);
}
- Debug::log(LOG, "moveWorkspaceToMonitor: Plugging gap with existing {}", nextWorkspaceOnMonitorID);
+ Log::logger->log(Log::DEBUG, "moveWorkspaceToMonitor: Plugging gap with existing {}", nextWorkspaceOnMonitorID);
if (POLDMON)
POLDMON->changeWorkspace(nextWorkspaceOnMonitorID, false, true, true);
}
@@ -2015,7 +2000,7 @@ void CCompositor::moveWorkspaceToMonitor(PHLWORKSPACE pWorkspace, PHLMONITOR pMo
}
if (SWITCHINGISACTIVE && POLDMON == Desktop::focusState()->monitor()) { // if it was active, preserve its' status. If it wasn't, don't.
- Debug::log(LOG, "moveWorkspaceToMonitor: SWITCHINGISACTIVE, active {} -> {}", pMonitor->activeWorkspaceID(), pWorkspace->m_id);
+ Log::logger->log(Log::DEBUG, "moveWorkspaceToMonitor: SWITCHINGISACTIVE, active {} -> {}", pMonitor->activeWorkspaceID(), pWorkspace->m_id);
if (valid(pMonitor->m_activeWorkspace)) {
pMonitor->m_activeWorkspace->m_visible = false;
@@ -2419,7 +2404,7 @@ Vector2D CCompositor::parseWindowVectorArgsRelative(const std::string& args, con
}
if (!isNumber(x) || !isNumber(y)) {
- Debug::log(ERR, "parseWindowVectorArgsRelative: args not numbers");
+ Log::logger->log(Log::ERR, "parseWindowVectorArgsRelative: args not numbers");
return relativeTo;
}
@@ -2449,7 +2434,7 @@ PHLWORKSPACE CCompositor::createNewWorkspace(const WORKSPACEID& id, const MONITO
const auto PMONITOR = getMonitorFromID(monID);
if (!PMONITOR) {
- Debug::log(ERR, "BUG THIS: No pMonitor for new workspace in createNewWorkspace");
+ Log::logger->log(Log::ERR, "BUG THIS: No pMonitor for new workspace in createNewWorkspace");
return nullptr;
}
@@ -2682,7 +2667,7 @@ void CCompositor::checkMonitorOverlaps() {
for (const auto& m : m_monitors) {
if (!monitorRegion.copy().intersect(m->logicalBox()).empty()) {
- Debug::log(ERR, "Monitor {}: detected overlap with layout", m->m_name);
+ Log::logger->log(Log::ERR, "Monitor {}: detected overlap with layout", m->m_name);
g_pHyprNotificationOverlay->addNotification(I18n::i18nEngine()->localize(I18n::TXT_KEY_NOTIF_INVALID_MONITOR_LAYOUT, {{"name", m->m_name}}), CHyprColor{}, 15000,
ICON_WARNING);
@@ -2700,14 +2685,14 @@ void CCompositor::arrangeMonitors() {
std::vector<PHLMONITOR> arranged;
arranged.reserve(toArrange.size());
- Debug::log(LOG, "arrangeMonitors: {} to arrange", toArrange.size());
+ Log::logger->log(Log::DEBUG, "arrangeMonitors: {} to arrange", toArrange.size());
for (auto it = toArrange.begin(); it != toArrange.end();) {
auto m = *it;
if (m->m_activeMonitorRule.offset != Vector2D{-INT32_MAX, -INT32_MAX}) {
// explicit.
- Debug::log(LOG, "arrangeMonitors: {} explicit {:j}", m->m_name, m->m_activeMonitorRule.offset);
+ Log::logger->log(Log::DEBUG, "arrangeMonitors: {} explicit {:j}", m->m_name, m->m_activeMonitorRule.offset);
m->moveTo(m->m_activeMonitorRule.offset);
arranged.push_back(m);
@@ -2782,7 +2767,7 @@ void CCompositor::arrangeMonitors() {
}
default: UNREACHABLE();
}
- Debug::log(LOG, "arrangeMonitors: {} auto {:j}", m->m_name, m->m_position);
+ Log::logger->log(Log::DEBUG, "arrangeMonitors: {} auto {:j}", m->m_name, m->m_position);
m->moveTo(newPosition);
arranged.emplace_back(m);
}
@@ -2791,7 +2776,7 @@ void CCompositor::arrangeMonitors() {
// and set xwayland positions aka auto for all
maxXOffsetRight = 0;
for (auto const& m : m_monitors) {
- Debug::log(LOG, "arrangeMonitors: {} xwayland [{}, {}]", m->m_name, maxXOffsetRight, 0);
+ Log::logger->log(Log::DEBUG, "arrangeMonitors: {} xwayland [{}, {}]", m->m_name, maxXOffsetRight, 0);
m->m_xwaylandPosition = {maxXOffsetRight, 0};
maxXOffsetRight += (*PXWLFORCESCALEZERO ? m->m_transformedSize.x : m->m_size.x);
@@ -2815,7 +2800,7 @@ void CCompositor::enterUnsafeState() {
if (m_unsafeState)
return;
- Debug::log(LOG, "Entering unsafe state");
+ Log::logger->log(Log::DEBUG, "Entering unsafe state");
if (!m_unsafeOutput->m_enabled)
m_unsafeOutput->onConnect(false);
@@ -2829,7 +2814,7 @@ void CCompositor::leaveUnsafeState() {
if (!m_unsafeState)
return;
- Debug::log(LOG, "Leaving unsafe state");
+ Log::logger->log(Log::DEBUG, "Leaving unsafe state");
m_unsafeState = false;
@@ -2857,7 +2842,7 @@ void CCompositor::setPreferredScaleForSurface(SP<CWLSurfaceResource> pSurface, d
const auto PSURFACE = Desktop::View::CWLSurface::fromResource(pSurface);
if (!PSURFACE) {
- Debug::log(WARN, "Orphaned CWLSurfaceResource {:x} in setPreferredScaleForSurface", rc<uintptr_t>(pSurface.get()));
+ Log::logger->log(Log::WARN, "Orphaned CWLSurfaceResource {:x} in setPreferredScaleForSurface", rc<uintptr_t>(pSurface.get()));
return;
}
@@ -2870,7 +2855,7 @@ void CCompositor::setPreferredTransformForSurface(SP<CWLSurfaceResource> pSurfac
const auto PSURFACE = Desktop::View::CWLSurface::fromResource(pSurface);
if (!PSURFACE) {
- Debug::log(WARN, "Orphaned CWLSurfaceResource {:x} in setPreferredTransformForSurface", rc<uintptr_t>(pSurface.get()));
+ Log::logger->log(Log::WARN, "Orphaned CWLSurfaceResource {:x} in setPreferredTransformForSurface", rc<uintptr_t>(pSurface.get()));
return;
}
@@ -2926,7 +2911,7 @@ void CCompositor::onNewMonitor(SP<Aquamarine::IOutput> output) {
output->name = "FALLBACK"; // we are allowed to do this :)
}
- Debug::log(LOG, "New output with name {}", output->name);
+ Log::logger->log(Log::DEBUG, "New output with name {}", output->name);
PNEWMONITOR->m_name = output->name;
PNEWMONITOR->m_self = PNEWMONITOR;
@@ -2965,24 +2950,24 @@ void CCompositor::onNewMonitor(SP<Aquamarine::IOutput> output) {
PNEWMONITOR->m_frameScheduler->onFrame();
if (PROTO::colorManagement && 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);
}
}
SImageDescription CCompositor::getPreferredImageDescription() {
if (!PROTO::colorManagement) {
- Debug::log(ERR, "FIXME: color management protocol is not enabled, returning empty image description");
+ Log::logger->log(Log::ERR, "FIXME: color management protocol is not enabled, returning empty image description");
return SImageDescription{};
}
- Debug::log(WARN, "FIXME: color management protocol is enabled, determine correct preferred image description");
+ Log::logger->log(Log::WARN, "FIXME: color management protocol is enabled, determine correct preferred image description");
// should determine some common settings to avoid unnecessary transformations while keeping maximum displayable precision
return m_monitors.size() == 1 ? m_monitors[0]->m_imageDescription : SImageDescription{.primaries = NColorPrimaries::BT709};
}
SImageDescription CCompositor::getHDRImageDescription() {
if (!PROTO::colorManagement) {
- Debug::log(ERR, "FIXME: color management protocol is not enabled, returning empty image description");
+ Log::logger->log(Log::ERR, "FIXME: color management protocol is not enabled, returning empty image description");
return SImageDescription{};
}
@@ -3002,7 +2987,7 @@ SImageDescription CCompositor::getHDRImageDescription() {
}
bool CCompositor::shouldChangePreferredImageDescription() {
- Debug::log(WARN, "FIXME: color management protocol is enabled and outputs changed, check preferred image description changes");
+ Log::logger->log(Log::WARN, "FIXME: color management protocol is enabled and outputs changed, check preferred image description changes");
return false;
}
@@ -3040,7 +3025,7 @@ void CCompositor::ensurePersistentWorkspacesPresent(const std::vector<SWorkspace
}
if (id == WORKSPACE_INVALID) {
- Debug::log(ERR, "ensurePersistentWorkspacesPresent: couldn't resolve id for workspace {}", rule.workspaceString);
+ Log::logger->log(Log::ERR, "ensurePersistentWorkspacesPresent: couldn't resolve id for workspace {}", rule.workspaceString);
continue;
}
PWORKSPACE = getWorkspaceByID(id);
@@ -3052,7 +3037,7 @@ void CCompositor::ensurePersistentWorkspacesPresent(const std::vector<SWorkspace
}
if (!PMONITOR) {
- Debug::log(ERR, "ensurePersistentWorkspacesPresent: couldn't resolve monitor for {}, skipping", rule.monitor);
+ Log::logger->log(Log::ERR, "ensurePersistentWorkspacesPresent: couldn't resolve monitor for {}, skipping", rule.monitor);
continue;
}
@@ -3064,12 +3049,12 @@ void CCompositor::ensurePersistentWorkspacesPresent(const std::vector<SWorkspace
if (PWORKSPACE) {
if (PWORKSPACE->m_monitor == PMONITOR) {
- Debug::log(LOG, "ensurePersistentWorkspacesPresent: workspace persistent {} already on {}", rule.workspaceString, PMONITOR->m_name);
+ Log::logger->log(Log::DEBUG, "ensurePersistentWorkspacesPresent: workspace persistent {} already on {}", rule.workspaceString, PMONITOR->m_name);
continue;
}
- Debug::log(LOG, "ensurePersistentWorkspacesPresent: workspace persistent {} not on {}, moving", rule.workspaceString, PMONITOR->m_name);
+ Log::logger->log(Log::DEBUG, "ensurePersistentWorkspacesPresent: workspace persistent {} not on {}, moving", rule.workspaceString, PMONITOR->m_name);
moveWorkspaceToMonitor(PWORKSPACE, PMONITOR);
continue;
}
diff --git a/src/config/ConfigDataValues.hpp b/src/config/ConfigDataValues.hpp
index 6461e9a5..8facfd9b 100644
--- a/src/config/ConfigDataValues.hpp
+++ b/src/config/ConfigDataValues.hpp
@@ -118,7 +118,7 @@ class CCssGapData : public ICustomConfigValueData {
break;
}
default: {
- Debug::log(WARN, "Too many arguments provided for gaps.");
+ Log::logger->log(Log::WARN, "Too many arguments provided for gaps.");
*this = CCssGapData(toInt(varlist[0]), toInt(varlist[1]), toInt(varlist[2]), toInt(varlist[3]));
break;
}
diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp
index 94147f49..1af5fb15 100644
--- a/src/config/ConfigManager.cpp
+++ b/src/config/ConfigManager.cpp
@@ -90,7 +90,7 @@ static Hyprlang::CParseResult configHandleGradientSet(const char* VALUE, void**
try {
DATA->m_angle = std::stoi(std::string(var.substr(0, var.find("deg")))) * (PI / 180.0); // radians
} catch (...) {
- Debug::log(WARN, "Error parsing gradient {}", V);
+ Log::logger->log(Log::WARN, "Error parsing gradient {}", V);
parseError = "Error parsing gradient " + V;
}
@@ -98,7 +98,7 @@ static Hyprlang::CParseResult configHandleGradientSet(const char* VALUE, void**
}
if (DATA->m_colors.size() >= 10) {
- Debug::log(WARN, "Error parsing gradient {}: max colors is 10.", V);
+ Log::logger->log(Log::WARN, "Error parsing gradient {}: max colors is 10.", V);
parseError = "Error parsing gradient " + V + ": max colors is 10.";
break;
}
@@ -109,13 +109,13 @@ static Hyprlang::CParseResult configHandleGradientSet(const char* VALUE, void**
throw std::runtime_error(std::format("failed to parse {} as a color", var));
DATA->m_colors.emplace_back(COL.value());
} catch (std::exception& e) {
- Debug::log(WARN, "Error parsing gradient {}", V);
+ Log::logger->log(Log::WARN, "Error parsing gradient {}", V);
parseError = "Error parsing gradient " + V + ": " + e.what();
}
}
if (DATA->m_colors.empty()) {
- Debug::log(WARN, "Error parsing gradient {}", V);
+ Log::logger->log(Log::WARN, "Error parsing gradient {}", V);
if (parseError.empty())
parseError = "Error parsing gradient " + V + ": No colors?";
@@ -880,18 +880,16 @@ CConfigManager::CConfigManager() {
resetHLConfig();
if (CONFIG_OPTIONS.size() != m_configValueNumber - 1 /* autogenerated is special */)
- Debug::log(LOG, "Warning: config descriptions have {} entries, but there are {} config values. This should fail tests!!", CONFIG_OPTIONS.size(), m_configValueNumber);
+ Log::logger->log(Log::DEBUG, "Warning: config descriptions have {} entries, but there are {} config values. This should fail tests!!", CONFIG_OPTIONS.size(),
+ m_configValueNumber);
if (!g_pCompositor->m_onlyConfigVerification) {
- Debug::log(
- INFO,
+ Log::logger->log(
+ Log::DEBUG,
"!!!!HEY YOU, YES YOU!!!!: further logs to stdout / logfile are disabled by default. BEFORE SENDING THIS LOG, ENABLE THEM. Use debug:disable_logs = false to do so: "
"https://wiki.hypr.land/Configuring/Variables/#debug");
}
- Debug::m_disableLogs = rc<int64_t* const*>(m_config->getConfigValuePtr("debug:disable_logs")->getDataStaticPtr());
- Debug::m_disableTime = rc<int64_t* const*>(m_config->getConfigValuePtr("debug:disable_time")->getDataStaticPtr());
-
if (g_pEventLoopManager && ERR.has_value())
g_pEventLoopManager->doLater([ERR] { g_pHyprError->queueCreate(ERR.value(), CHyprColor{1.0, 0.1, 0.1, 1.0}); });
}
@@ -923,14 +921,14 @@ std::optional<std::string> CConfigManager::generateConfig(std::string configPath
std::error_code ec;
bool created = std::filesystem::create_directories(parentPath, ec);
if (ec) {
- Debug::log(ERR, "Couldn't create config home directory ({}): {}", ec.message(), parentPath);
+ Log::logger->log(Log::ERR, "Couldn't create config home directory ({}): {}", ec.message(), parentPath);
return "Config could not be generated.";
}
if (created)
- Debug::log(WARN, "Creating config home directory");
+ Log::logger->log(Log::WARN, "Creating config home directory");
}
- Debug::log(WARN, "No config file found; attempting to generate.");
+ Log::logger->log(Log::WARN, "No config file found; attempting to generate.");
std::ofstream ofs;
ofs.open(configPath, std::ios::trunc);
if (!safeMode) {
@@ -1002,7 +1000,7 @@ std::string CConfigManager::getConfigString() {
std::ifstream configFile(path);
configString += ("\n\nConfig File: " + path + ": ");
if (!configFile.is_open()) {
- Debug::log(LOG, "Config file not readable/found!");
+ Log::logger->log(Log::DEBUG, "Config file not readable/found!");
configString += "Read Failed\n";
continue;
}
@@ -1129,7 +1127,7 @@ std::optional<std::string> CConfigManager::resetHLConfig() {
// paths
m_configPaths.clear();
std::string mainConfigPath = getMainConfigPath();
- Debug::log(LOG, "Using config: {}", mainConfigPath);
+ Log::logger->log(Log::DEBUG, "Using config: {}", mainConfigPath);
m_configPaths.emplace_back(mainConfigPath);
const auto RET = verifyConfigExists();
@@ -1397,11 +1395,9 @@ void CConfigManager::postConfigReload(const Hyprlang::CParseResult& result) {
g_pHyprRenderer->initiateManualCrash();
}
- Debug::m_disableStdout = !std::any_cast<Hyprlang::INT>(m_config->getConfigValue("debug:enable_stdout_logs"));
- if (Debug::m_disableStdout && m_isFirstLaunch)
- Debug::log(LOG, "Disabling stdout logs! Check the log for further logs.");
-
- Debug::m_coloredLogs = rc<int64_t* const*>(m_config->getConfigValuePtr("debug:colored_stdout_logs")->getDataStaticPtr());
+ auto disableStdout = !std::any_cast<Hyprlang::INT>(m_config->getConfigValue("debug:enable_stdout_logs"));
+ if (disableStdout && m_isFirstLaunch)
+ Log::logger->log(Log::DEBUG, "Disabling stdout logs! Check the log for further logs.");
for (auto const& m : g_pCompositor->m_monitors) {
// mark blur dirty
@@ -1435,7 +1431,7 @@ void CConfigManager::postConfigReload(const Hyprlang::CParseResult& result) {
void CConfigManager::init() {
g_pConfigWatcher->setOnChange([this](const CConfigWatcher::SConfigWatchEvent& e) {
- Debug::log(LOG, "CConfigManager: file {} modified, reloading", e.file);
+ Log::logger->log(Log::DEBUG, "CConfigManager: file {} modified, reloading", e.file);
reload();
});
@@ -1516,35 +1512,35 @@ SMonitorRule CConfigManager::getMonitorRuleFor(const PHLMONITOR PMONITOR) {
if (!CONFIG)
return rule;
- Debug::log(LOG, "CConfigManager::getMonitorRuleFor: found a wlr_output_manager override for {}", PMONITOR->m_name);
+ Log::logger->log(Log::DEBUG, "CConfigManager::getMonitorRuleFor: found a wlr_output_manager override for {}", PMONITOR->m_name);
- Debug::log(LOG, " > overriding enabled: {} -> {}", !rule.disabled, !CONFIG->enabled);
+ Log::logger->log(Log::DEBUG, " > overriding enabled: {} -> {}", !rule.disabled, !CONFIG->enabled);
rule.disabled = !CONFIG->enabled;
if ((CONFIG->committedProperties & OUTPUT_HEAD_COMMITTED_MODE) || (CONFIG->committedProperties & OUTPUT_HEAD_COMMITTED_CUSTOM_MODE)) {
- Debug::log(LOG, " > overriding mode: {:.0f}x{:.0f}@{:.2f}Hz -> {:.0f}x{:.0f}@{:.2f}Hz", rule.resolution.x, rule.resolution.y, rule.refreshRate, CONFIG->resolution.x,
- CONFIG->resolution.y, CONFIG->refresh / 1000.F);
+ Log::logger->log(Log::DEBUG, " > overriding mode: {:.0f}x{:.0f}@{:.2f}Hz -> {:.0f}x{:.0f}@{:.2f}Hz", rule.resolution.x, rule.resolution.y, rule.refreshRate,
+ CONFIG->resolution.x, CONFIG->resolution.y, CONFIG->refresh / 1000.F);
rule.resolution = CONFIG->resolution;
rule.refreshRate = CONFIG->refresh / 1000.F;
}
if (CONFIG->committedProperties & OUTPUT_HEAD_COMMITTED_POSITION) {
- Debug::log(LOG, " > overriding offset: {:.0f}, {:.0f} -> {:.0f}, {:.0f}", rule.offset.x, rule.offset.y, CONFIG->position.x, CONFIG->position.y);
+ Log::logger->log(Log::DEBUG, " > overriding offset: {:.0f}, {:.0f} -> {:.0f}, {:.0f}", rule.offset.x, rule.offset.y, CONFIG->position.x, CONFIG->position.y);
rule.offset = CONFIG->position;
}
if (CONFIG->committedProperties & OUTPUT_HEAD_COMMITTED_TRANSFORM) {
- Debug::log(LOG, " > overriding transform: {} -> {}", sc<uint8_t>(rule.transform), sc<uint8_t>(CONFIG->transform));
+ Log::logger->log(Log::DEBUG, " > overriding transform: {} -> {}", sc<uint8_t>(rule.transform), sc<uint8_t>(CONFIG->transform));
rule.transform = CONFIG->transform;
}
if (CONFIG->committedProperties & OUTPUT_HEAD_COMMITTED_SCALE) {
- Debug::log(LOG, " > overriding scale: {} -> {}", sc<uint8_t>(rule.scale), sc<uint8_t>(CONFIG->scale));
+ Log::logger->log(Log::DEBUG, " > overriding scale: {} -> {}", sc<uint8_t>(rule.scale), sc<uint8_t>(CONFIG->scale));
rule.scale = CONFIG->scale;
}
if (CONFIG->committedProperties & OUTPUT_HEAD_COMMITTED_ADAPTIVE_SYNC) {
- Debug::log(LOG, " > overriding vrr: {} -> {}", rule.vrr.value_or(0), CONFIG->adaptiveSync);
+ Log::logger->log(Log::DEBUG, " > overriding vrr: {} -> {}", rule.vrr.value_or(0), CONFIG->adaptiveSync);
rule.vrr = sc<int>(CONFIG->adaptiveSync);
}
@@ -1557,7 +1553,7 @@ SMonitorRule CConfigManager::getMonitorRuleFor(const PHLMONITOR PMONITOR) {
}
}
- Debug::log(WARN, "No rule found for {}, trying to use the first.", PMONITOR->m_name);
+ Log::logger->log(Log::WARN, "No rule found for {}, trying to use the first.", PMONITOR->m_name);
for (auto const& r : m_monitorRules) {
if (r.name.empty()) {
@@ -1565,7 +1561,7 @@ SMonitorRule CConfigManager::getMonitorRuleFor(const PHLMONITOR PMONITOR) {
}
}
- Debug::log(WARN, "No rules configured. Using the default hardcoded one.");
+ Log::logger->log(Log::WARN, "No rules configured. Using the default hardcoded one.");
return applyWlrOutputConfig(SMonitorRule{.autoDir = eAutoDirs::DIR_AUTO_RIGHT,
.name = "",
@@ -1767,7 +1763,7 @@ void CConfigManager::ensureVRR(PHLMONITOR pMonitor) {
m->m_output->state->setAdaptiveSync(false);
if (!m->m_state.commit())
- Debug::log(ERR, "Couldn't commit output {} in ensureVRR -> false", m->m_output->name);
+ Log::logger->log(Log::ERR, "Couldn't commit output {} in ensureVRR -> false", m->m_output->name);
}
m->m_vrrActive = false;
return;
@@ -1777,12 +1773,12 @@ void CConfigManager::ensureVRR(PHLMONITOR pMonitor) {
m->m_output->state->setAdaptiveSync(true);
if (!m->m_state.test()) {
- Debug::log(LOG, "Pending output {} does not accept VRR.", m->m_output->name);
+ Log::logger->log(Log::DEBUG, "Pending output {} does not accept VRR.", m->m_output->name);
m->m_output->state->setAdaptiveSync(false);
}
if (!m->m_state.commit())
- Debug::log(ERR, "Couldn't commit output {} in ensureVRR -> true", m->m_output->name);
+ Log::logger->log(Log::ERR, "Couldn't commit output {} in ensureVRR -> true", m->m_output->name);
}
m->m_vrrActive = true;
return;
@@ -1809,7 +1805,7 @@ void CConfigManager::ensureVRR(PHLMONITOR pMonitor) {
m->m_output->state->setAdaptiveSync(true);
if (!m->m_state.test()) {
- Debug::log(LOG, "Pending output {} does not accept VRR.", m->m_output->name);
+ Log::logger->log(Log::DEBUG, "Pending output {} does not accept VRR.", m->m_output->name);
m->m_output->state->setAdaptiveSync(false);
}
}
@@ -1981,7 +1977,7 @@ static bool parseModeLine(const std::string& modeline, drmModeModeInfo& mode) {
return false;
if (args.size() < 10) {
- Debug::log(ERR, "modeline parse error: expected at least 9 arguments, got {}", args.size() - 1);
+ Log::logger->log(Log::ERR, "modeline parse error: expected at least 9 arguments, got {}", args.size() - 1);
return false;
}
@@ -2000,7 +1996,7 @@ static bool parseModeLine(const std::string& modeline, drmModeModeInfo& mode) {
mode.vtotal = std::stoi(args[argno++]);
mode.vrefresh = mode.clock * 1000.0 * 1000.0 / mode.htotal / mode.vtotal;
} catch (const std::exception& e) {
- Debug::log(ERR, "modeline parse error: invalid numeric value: {}", e.what());
+ Log::logger->log(Log::ERR, "modeline parse error: invalid numeric value: {}", e.what());
return false;
}
@@ -2023,7 +2019,7 @@ static bool parseModeLine(const std::string& modeline, drmModeModeInfo& mode) {
if (it != flagsmap.end())
mode.flags |= it->second;
else
- Debug::log(ERR, "Invalid flag {} in modeline", key);
+ Log::logger->log(Log::ERR, "Invalid flag {} in modeline", key);
}
snprintf(mode.name, sizeof(mode.name), "%dx%d@%d", mode.hdisplay, mode.vdisplay, mode.vrefresh / 1000);
@@ -2105,11 +2101,11 @@ bool CMonitorRuleParser::parsePosition(const std::string& value, bool isFirst) {
else if (value == "auto-center-down")
m_rule.autoDir = eAutoDirs::DIR_AUTO_CENTER_DOWN;
else {
- Debug::log(WARN,
- "Invalid auto direction. Valid options are 'auto',"
- "'auto-up', 'auto-down', 'auto-left', 'auto-right',"
- "'auto-center-up', 'auto-center-down',"
- "'auto-center-left', and 'auto-center-right'.");
+ Log::logger->log(Log::WARN,
+ "Invalid auto direction. Valid options are 'auto',"
+ "'auto-up', 'auto-down', 'auto-left', 'auto-right',"
+ "'auto-center-up', 'auto-center-down',"
+ "'auto-center-left', and 'auto-center-right'.");
m_error += "invalid auto direction ";
return false;
}
@@ -2160,7 +2156,7 @@ bool CMonitorRuleParser::parseTransform(const std::string& value) {
const auto TSF = std::stoi(value);
if (std::clamp(TSF, 0, 7) != TSF) {
- Debug::log(ERR, "Invalid transform {} in monitor", TSF);
+ Log::logger->log(Log::ERR, "Invalid transform {} in monitor", TSF);
m_error += "invalid transform ";
return false;
}
@@ -2268,7 +2264,7 @@ std::optional<std::string> CConfigManager::handleMonitor(const std::string& comm
// fall
} else {
- Debug::log(ERR, "ConfigManager parseMonitor, curitem bogus???");
+ Log::logger->log(Log::ERR, "ConfigManager parseMonitor, curitem bogus???");
return "parse error: curitem bogus";
}
@@ -2319,7 +2315,7 @@ std::optional<std::string> CConfigManager::handleMonitor(const std::string& comm
m_workspaceRules.emplace_back(wsRule);
argno++;
} else {
- Debug::log(ERR, "Config error: invalid monitor syntax at \"{}\"", ARGS[argno]);
+ Log::logger->log(Log::ERR, "Config error: invalid monitor syntax at \"{}\"", ARGS[argno]);
return "invalid syntax at \"" + std::string(ARGS[argno]) + "\"";
}
@@ -2536,12 +2532,12 @@ std::optional<std::string> CConfigManager::handleBind(const std::string& command
const auto DISPATCHER = g_pKeybindManager->m_dispatchers.find(HANDLER);
if (DISPATCHER == g_pKeybindManager->m_dispatchers.end()) {
- Debug::log(ERR, "Invalid dispatcher: {}", HANDLER);
+ Log::logger->log(Log::ERR, "Invalid dispatcher: {}", HANDLER);
return "Invalid dispatcher, requested \"" + HANDLER + "\" does not exist";
}
if (MOD == 0 && !MODSTR.empty()) {
- Debug::log(ERR, "Invalid mod: {}", MODSTR);
+ Log::logger->log(Log::ERR, "Invalid mod: {}", MODSTR);
return "Invalid mod, requested mod \"" + MODSTR + "\" is not a valid mod.";
}
@@ -2549,7 +2545,7 @@ std::optional<std::string> CConfigManager::handleBind(const std::string& command
SParsedKey parsedKey = parseKey(KEY);
if (parsedKey.catchAll && m_currentSubmap.name.empty()) {
- Debug::log(ERR, "Catchall not allowed outside of submap!");
+ Log::logger->log(Log::ERR, "Catchall not allowed outside of submap!");
return "Invalid catchall, catchall keybinds are only allowed in submaps.";
}
@@ -2599,7 +2595,7 @@ std::optional<std::string> CConfigManager::handleWorkspaceRules(const std::strin
// auto wsIdent = removeBeginEndSpacesTabs(value.substr(FIRST_DELIM + 1, (WORKSPACE_DELIM - FIRST_DELIM - 1)));
// id = getWorkspaceIDFromString(wsIdent, name);
// if (id == WORKSPACE_INVALID) {
- // Debug::log(ERR, "Invalid workspace identifier found: {}", wsIdent);
+ // Log::logger->log(Log::ERR, "Invalid workspace identifier found: {}", wsIdent);
// return "Invalid workspace identifier found: " + wsIdent;
// }
// wsRule.monitor = first_ident;
@@ -2665,7 +2661,7 @@ std::optional<std::string> CConfigManager::handleWorkspaceRules(const std::strin
std::string opt = rule.substr(delim + 10);
if (!opt.contains(":")) {
// invalid
- Debug::log(ERR, "Invalid workspace rule found: {}", rule);
+ Log::logger->log(Log::ERR, "Invalid workspace rule found: {}", rule);
return "Invalid workspace rule found: " + rule;
}
@@ -2709,7 +2705,7 @@ std::optional<std::string> CConfigManager::handleSubmap(const std::string&, cons
std::optional<std::string> CConfigManager::handleSource(const std::string& command, const std::string& rawpath) {
if (rawpath.length() < 2) {
- Debug::log(ERR, "source= path garbage");
+ Log::logger->log(Log::ERR, "source= path garbage");
return "source= path " + rawpath + " bogus!";
}
@@ -2723,7 +2719,7 @@ std::optional<std::string> CConfigManager::handleSource(const std::string& comma
if (auto r = glob(absolutePath(rawpath, m_configCurrentPath).c_str(), GLOB_TILDE, nullptr, glob_buf.get()); r != 0) {
std::string err = std::format("source= globbing error: {}", r == GLOB_NOMATCH ? "found no match" : GLOB_ABORTED ? "read error" : "out of memory");
- Debug::log(ERR, "{}", err);
+ Log::logger->log(Log::ERR, "{}", err);
return err;
}
@@ -2736,7 +2732,7 @@ std::optional<std::string> CConfigManager::handleSource(const std::string& comma
auto file_status = std::filesystem::status(value, ec);
if (ec) {
- Debug::log(ERR, "source= file from glob result is inaccessible ({}): {}", ec.message(), value);
+ Log::logger->log(Log::ERR, "source= file from glob result is inaccessible ({}): {}", ec.message(), value);
return "source= file " + value + " is inaccessible!";
}
@@ -2749,10 +2745,10 @@ std::optional<std::string> CConfigManager::handleSource(const std::string& comma
if (THISRESULT.error && errorsFromParsing.empty())
errorsFromParsing += THISRESULT.getError();
} else if (std::filesystem::is_directory(file_status)) {
- Debug::log(WARN, "source= skipping directory {}", value);
+ Log::logger->log(Log::WARN, "source= skipping directory {}", value);
continue;
} else {
- Debug::log(WARN, "source= skipping non-regular-file {}", value);
+ Log::logger->log(Log::WARN, "source= skipping non-regular-file {}", value);
continue;
}
}
@@ -3007,7 +3003,7 @@ std::string SConfigOptionDescription::jsonify() const {
[this](auto&& val) {
const auto PTR = g_pConfigManager->m_config->getConfigValuePtr(value.c_str());
if (!PTR) {
- Debug::log(ERR, "invalid SConfigOptionDescription: no config option {} exists", value);
+ Log::logger->log(Log::ERR, "invalid SConfigOptionDescription: no config option {} exists", value);
return std::string{""};
}
const char* const EXPLICIT = PTR->m_bSetByUser ? "true" : "false";
@@ -3084,7 +3080,7 @@ std::string SConfigOptionDescription::jsonify() const {
val.gradient, currentValue, EXPLICIT);
}
- } catch (std::bad_any_cast& e) { Debug::log(ERR, "Bad any_cast on value {} in descriptions", value); }
+ } catch (std::bad_any_cast& e) { Log::logger->log(Log::ERR, "Bad any_cast on value {} in descriptions", value); }
return std::string{""};
},
data);
@@ -3109,7 +3105,7 @@ void CConfigManager::ensurePersistentWorkspacesPresent() {
}
void CConfigManager::storeFloatingSize(PHLWINDOW window, const Vector2D& size) {
- Debug::log(LOG, "storing floating size {}x{} for window {}::{}", size.x, size.y, window->m_initialClass, window->m_initialTitle);
+ Log::logger->log(Log::DEBUG, "storing floating size {}x{} for window {}::{}", size.x, size.y, window->m_initialClass, window->m_initialTitle);
// true -> use m_initialClass and m_initialTitle
SFloatCache id{window, true};
m_mStoredFloatingSizes[id] = size;
@@ -3120,9 +3116,9 @@ std::optional<Vector2D> CConfigManager::getStoredFloatingSize(PHLWINDOW window)
// and m_class and m_title are just "initial" ones.
// false -> use m_class and m_title
SFloatCache id{window, false};
- Debug::log(LOG, "Hash for window {}::{} = {}", window->m_class, window->m_title, id.hash);
+ Log::logger->log(Log::DEBUG, "Hash for window {}::{} = {}", window->m_class, window->m_title, id.hash);
if (m_mStoredFloatingSizes.contains(id)) {
- Debug::log(LOG, "got stored size {}x{} for window {}::{}", m_mStoredFloatingSizes[id].x, m_mStoredFloatingSizes[id].y, window->m_class, window->m_title);
+ Log::logger->log(Log::DEBUG, "got stored size {}x{} for window {}::{}", m_mStoredFloatingSizes[id].x, m_mStoredFloatingSizes[id].y, window->m_class, window->m_title);
return m_mStoredFloatingSizes[id];
}
return std::nullopt;
diff --git a/src/config/ConfigWatcher.cpp b/src/config/ConfigWatcher.cpp
index dfd84b43..83f3011c 100644
--- a/src/config/ConfigWatcher.cpp
+++ b/src/config/ConfigWatcher.cpp
@@ -3,7 +3,7 @@
#include <linux/limits.h>
#endif
#include <sys/inotify.h>
-#include "../debug/Log.hpp"
+#include "../debug/log/Logger.hpp"
#include <ranges>
#include <fcntl.h>
#include <unistd.h>
@@ -13,14 +13,14 @@ using namespace Hyprutils::OS;
CConfigWatcher::CConfigWatcher() : m_inotifyFd(inotify_init()) {
if (!m_inotifyFd.isValid()) {
- Debug::log(ERR, "CConfigWatcher couldn't open an inotify node. Config will not be automatically reloaded");
+ Log::logger->log(Log::ERR, "CConfigWatcher couldn't open an inotify node. Config will not be automatically reloaded");
return;
}
// TODO: make CFileDescriptor take F_GETFL, F_SETFL
const int FLAGS = fcntl(m_inotifyFd.get(), F_GETFL, 0);
if (fcntl(m_inotifyFd.get(), F_SETFL, FLAGS | O_NONBLOCK) < 0) {
- Debug::log(ERR, "CConfigWatcher couldn't non-block inotify node. Config will not be automatically reloaded");
+ Log::logger->log(Log::ERR, "CConfigWatcher couldn't non-block inotify node. Config will not be automatically reloaded");
m_inotifyFd.reset();
return;
}
@@ -78,19 +78,19 @@ void CConfigWatcher::onInotifyEvent() {
const auto* ev = rc<const inotify_event*>(buffer.data() + offset);
if (offset + sizeof(inotify_event) > sc<size_t>(bytesRead)) {
- Debug::log(ERR, "CConfigWatcher: malformed inotify event, truncated header");
+ Log::logger->log(Log::ERR, "CConfigWatcher: malformed inotify event, truncated header");
break;
}
if (offset + sizeof(inotify_event) + ev->len > sc<size_t>(bytesRead)) {
- Debug::log(ERR, "CConfigWatcher: malformed inotify event, truncated name field");
+ Log::logger->log(Log::ERR, "CConfigWatcher: malformed inotify event, truncated name field");
break;
}
const auto WD = std::ranges::find_if(m_watches, [wd = ev->wd](const auto& e) { return e.wd == wd; });
if (WD == m_watches.end())
- Debug::log(ERR, "CConfigWatcher: got an event for wd {} which we don't have?!", ev->wd);
+ Log::logger->log(Log::ERR, "CConfigWatcher: got an event for wd {} which we don't have?!", ev->wd);
else
m_watchCallback(SConfigWatchEvent{
.file = WD->file,
diff --git a/src/debug/HyprCtl.cpp b/src/debug/HyprCtl.cpp
index 5e21d699..90adab91 100644
--- a/src/debug/HyprCtl.cpp
+++ b/src/debug/HyprCtl.cpp
@@ -40,7 +40,7 @@ using namespace Hyprutils::OS;
#include "../devices/ITouch.hpp"
#include "../devices/Tablet.hpp"
#include "../protocols/GlobalShortcuts.hpp"
-#include "debug/RollingLogFollow.hpp"
+#include "debug/log/RollingLogFollow.hpp"
#include "config/ConfigManager.hpp"
#include "helpers/MiscFunctions.hpp"
#include "../desktop/view/LayerSurface.hpp"
@@ -957,11 +957,10 @@ static std::string rollinglogRequest(eHyprCtlOutputFormat format, std::string re
if (format == eHyprCtlOutputFormat::FORMAT_JSON) {
result += "[\n\"log\":\"";
- result += escapeJSONStrings(Debug::m_rollingLog);
+ result += escapeJSONStrings(Log::logger->rolling());
result += "\"]";
- } else {
- result = Debug::m_rollingLog;
- }
+ } else
+ result = Log::logger->rolling();
return result;
}
@@ -1260,7 +1259,7 @@ static std::string dispatchRequest(eHyprCtlOutputFormat format, std::string in)
SDispatchResult res = DISPATCHER->second(DISPATCHARG);
- Debug::log(LOG, "Hyprctl: dispatcher {} : {}{}", DISPATCHSTR, DISPATCHARG, res.success ? "" : " -> " + res.error);
+ Log::logger->log(Log::DEBUG, "Hyprctl: dispatcher {} : {}{}", DISPATCHSTR, DISPATCHARG, res.success ? "" : " -> " + res.error);
return res.success ? "ok" : res.error;
}
@@ -1340,7 +1339,7 @@ static std::string dispatchKeyword(eHyprCtlOutputFormat format, std::string in)
if (COMMAND.contains("workspace"))
g_pConfigManager->ensurePersistentWorkspacesPresent();
- Debug::log(LOG, "Hyprctl: keyword {} : {}", COMMAND, VALUE);
+ Log::logger->log(Log::DEBUG, "Hyprctl: keyword {} : {}", COMMAND, VALUE);
if (retval.empty())
return "ok";
@@ -2223,23 +2222,23 @@ static bool successWrite(int fd, const std::string& data, bool needLog = true) {
return true;
if (needLog)
- Debug::log(ERR, "Couldn't write to socket. Error: " + std::string(strerror(errno)));
+ Log::logger->log(Log::ERR, "Couldn't write to socket. Error: " + std::string(strerror(errno)));
return false;
}
static void runWritingDebugLogThread(const int conn) {
using namespace std::chrono_literals;
- Debug::log(LOG, "In followlog thread, got connection, start writing: {}", conn);
+ Log::logger->log(Log::DEBUG, "In followlog thread, got connection, start writing: {}", conn);
//will be finished, when reading side close connection
std::thread([conn]() {
- while (Debug::SRollingLogFollow::get().isRunning()) {
- if (Debug::SRollingLogFollow::get().isEmpty(conn)) {
+ while (Log::SRollingLogFollow::get().isRunning()) {
+ if (Log::SRollingLogFollow::get().isEmpty(conn)) {
std::this_thread::sleep_for(1000ms);
continue;
}
- auto line = Debug::SRollingLogFollow::get().getLog(conn);
+ auto line = Log::SRollingLogFollow::get().getLog(conn);
if (!successWrite(conn, line))
// We cannot write, when connection is closed. So thread will successfully exit by itself
break;
@@ -2247,7 +2246,7 @@ static void runWritingDebugLogThread(const int conn) {
std::this_thread::sleep_for(100ms);
}
close(conn);
- Debug::SRollingLogFollow::get().stopFor(conn);
+ Log::SRollingLogFollow::get().stopFor(conn);
}).detach();
}
@@ -2273,10 +2272,10 @@ static int hyprCtlFDTick(int fd, uint32_t mask, void* data) {
CRED_T creds;
uint32_t len = sizeof(creds);
if (getsockopt(ACCEPTEDCONNECTION, CRED_LVL, CRED_OPT, &creds, &len) == -1)
- Debug::log(ERR, "Hyprctl: failed to get peer creds");
+ Log::logger->log(Log::ERR, "Hyprctl: failed to get peer creds");
else {
g_pHyprCtl->m_currentRequestParams.pid = creds.CRED_PID;
- Debug::log(LOG, "Hyprctl: new connection from pid {}", creds.CRED_PID);
+ Log::logger->log(Log::DEBUG, "Hyprctl: new connection from pid {}", creds.CRED_PID);
}
//
@@ -2311,7 +2310,7 @@ static int hyprCtlFDTick(int fd, uint32_t mask, void* data) {
try {
reply = g_pHyprCtl->getReply(request);
} catch (std::exception& e) {
- Debug::log(ERR, "Error in request: {}", e.what());
+ Log::logger->log(Log::ERR, "Error in request: {}", e.what());
reply = "Err: " + std::string(e.what());
}
@@ -2331,10 +2330,10 @@ static int hyprCtlFDTick(int fd, uint32_t mask, void* data) {
successWrite(ACCEPTEDCONNECTION, reply);
if (isFollowUpRollingLogRequest(request)) {
- Debug::log(LOG, "Followup rollinglog request received. Starting thread to write to socket.");
- Debug::SRollingLogFollow::get().startFor(ACCEPTEDCONNECTION);
+ Log::logger->log(Log::DEBUG, "Followup rollinglog request received. Starting thread to write to socket.");
+ Log::SRollingLogFollow::get().startFor(ACCEPTEDCONNECTION);
runWritingDebugLogThread(ACCEPTEDCONNECTION);
- Debug::log(LOG, Debug::SRollingLogFollow::get().debugInfo());
+ Log::logger->log(Log::DEBUG, Log::SRollingLogFollow::get().debugInfo());
} else
close(ACCEPTEDCONNECTION);
@@ -2351,7 +2350,7 @@ void CHyprCtl::startHyprCtlSocket() {
m_socketFD = CFileDescriptor{socket(AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0)};
if (!m_socketFD.isValid()) {
- Debug::log(ERR, "Couldn't start the Hyprland Socket. (1) IPC will not work.");
+ Log::logger->log(Log::ERR, "Couldn't start the Hyprland Socket. (1) IPC will not work.");
return;
}
@@ -2362,14 +2361,14 @@ void CHyprCtl::startHyprCtlSocket() {
snprintf(SERVERADDRESS.sun_path, sizeof(SERVERADDRESS.sun_path), "%s", m_socketPath.c_str());
if (bind(m_socketFD.get(), rc<sockaddr*>(&SERVERADDRESS), SUN_LEN(&SERVERADDRESS)) < 0) {
- Debug::log(ERR, "Couldn't start the Hyprland Socket. (2) IPC will not work.");
+ Log::logger->log(Log::ERR, "Couldn't start the Hyprland Socket. (2) IPC will not work.");
return;
}
// 10 max queued.
listen(m_socketFD.get(), 10);
- Debug::log(LOG, "Hypr socket started at {}", m_socketPath);
+ Log::logger->log(Log::DEBUG, "Hypr socket started at {}", m_socketPath);
m_eventSource = wl_event_loop_add_fd(g_pCompositor->m_wlEventLoop, m_socketFD.get(), WL_EVENT_READABLE, hyprCtlFDTick, nullptr);
}
diff --git a/src/debug/Log.cpp b/src/debug/Log.cpp
deleted file mode 100644
index e70617d3..00000000
--- a/src/debug/Log.cpp
+++ /dev/null
@@ -1,78 +0,0 @@
-#include "Log.hpp"
-#include "../defines.hpp"
-#include "RollingLogFollow.hpp"
-
-#include <fstream>
-#include <print>
-#include <fcntl.h>
-
-void Debug::init(const std::string& IS) {
- m_logFile = IS + (ISDEBUG ? "/hyprlandd.log" : "/hyprland.log");
- m_logOfs.open(m_logFile, std::ios::out | std::ios::app);
- auto handle = m_logOfs.native_handle();
- fcntl(handle, F_SETFD, FD_CLOEXEC);
-}
-
-void Debug::close() {
- m_logOfs.close();
-}
-
-void Debug::log(eLogLevel level, std::string str) {
- if (level == TRACE && !m_trace)
- return;
-
- if (m_shuttingDown)
- return;
-
- std::lock_guard<std::mutex> guard(m_logMutex);
-
- std::string coloredStr = str;
- //NOLINTBEGIN
- switch (level) {
- case LOG:
- str = "[LOG] " + str;
- coloredStr = str;
- break;
- case WARN:
- str = "[WARN] " + str;
- coloredStr = "\033[1;33m" + str + "\033[0m"; // yellow
- break;
- case ERR:
- str = "[ERR] " + str;
- coloredStr = "\033[1;31m" + str + "\033[0m"; // red
- break;
- case CRIT:
- str = "[CRITICAL] " + str;
- coloredStr = "\033[1;35m" + str + "\033[0m"; // magenta
- break;
- case INFO:
- str = "[INFO] " + str;
- coloredStr = "\033[1;32m" + str + "\033[0m"; // green
- break;
- case TRACE:
- str = "[TRACE] " + str;
- coloredStr = "\033[1;34m" + str + "\033[0m"; // blue
- break;
- default: break;
- }
- //NOLINTEND
-
- m_rollingLog += str + "\n";
- if (m_rollingLog.size() > ROLLING_LOG_SIZE)
- m_rollingLog = m_rollingLog.substr(m_rollingLog.size() - ROLLING_LOG_SIZE);
-
- if (SRollingLogFollow::get().isRunning())
- SRollingLogFollow::get().addLog(str);
-
- if (!m_disableLogs || !**m_disableLogs) {
- // log to a file
- m_logOfs << str << "\n";
- m_logOfs.flush();
- }
-
- // log it to the stdout too.
- if (!m_disableStdout) {
- std::println("{}", ((m_coloredLogs && !**m_coloredLogs) ? str : coloredStr));
- std::fflush(stdout);
- }
-}
diff --git a/src/debug/Log.hpp b/src/debug/Log.hpp
deleted file mode 100644
index c3146805..00000000
--- a/src/debug/Log.hpp
+++ /dev/null
@@ -1,75 +0,0 @@
-#pragma once
-#include <string>
-#include <format>
-#include <iostream>
-#include <fstream>
-#include <chrono>
-#include <mutex>
-
-#define LOGMESSAGESIZE 1024
-#define ROLLING_LOG_SIZE 4096
-
-enum eLogLevel : int8_t {
- NONE = -1,
- LOG = 0,
- WARN,
- ERR,
- CRIT,
- INFO,
- TRACE
-};
-
-// NOLINTNEXTLINE(readability-identifier-naming)
-namespace Debug {
- inline std::string m_logFile;
- inline std::ofstream m_logOfs;
- inline int64_t* const* m_disableLogs = nullptr;
- inline int64_t* const* m_disableTime = nullptr;
- inline bool m_disableStdout = false;
- inline bool m_trace = false;
- inline bool m_shuttingDown = false;
- inline int64_t* const* m_coloredLogs = nullptr;
-
- inline std::string m_rollingLog = ""; // rolling log contains the ROLLING_LOG_SIZE tail of the log
- inline std::mutex m_logMutex;
-
- void init(const std::string& IS);
- void close();
-
- //
- void log(eLogLevel level, std::string str);
-
- template <typename... Args>
- //NOLINTNEXTLINE
- void log(eLogLevel level, std::format_string<Args...> fmt, Args&&... args) {
- if (level == TRACE && !m_trace)
- return;
-
- if (m_shuttingDown)
- return;
-
- std::string logMsg = "";
-
- // print date and time to the ofs
- if (m_disableTime && !**m_disableTime) {
-#ifndef _LIBCPP_VERSION
- static auto current_zone = std::chrono::current_zone();
- const auto zt = std::chrono::zoned_time{current_zone, std::chrono::system_clock::now()};
- const auto hms = std::chrono::hh_mm_ss{zt.get_local_time() - std::chrono::floor<std::chrono::days>(zt.get_local_time())};
-#else
- // TODO: current clang 17 does not support `zoned_time`, remove this once clang 19 is ready
- const auto hms = std::chrono::hh_mm_ss{std::chrono::system_clock::now() - std::chrono::floor<std::chrono::days>(std::chrono::system_clock::now())};
-#endif
- logMsg += std::format("[{}] ", hms);
- }
-
- // no need for try {} catch {} because std::format_string<Args...> ensures that vformat never throw std::format_error
- // because
- // 1. any faulty format specifier that sucks will cause a compilation error.
- // 2. and `std::bad_alloc` is catastrophic, (Almost any operation in stdlib could throw this.)
- // 3. this is actually what std::format in stdlib does
- logMsg += std::vformat(fmt.get(), std::make_format_args(args...));
-
- log(level, logMsg);
- }
-};
diff --git a/src/debug/TracyDefines.hpp b/src/debug/TracyDefines.hpp
index 49d296f6..d06332f3 100644
--- a/src/debug/TracyDefines.hpp
+++ b/src/debug/TracyDefines.hpp
@@ -2,7 +2,7 @@
#ifdef USE_TRACY_GPU
-#include "Log.hpp"
+#include "log/Logger.hpp"
#include <GL/gl.h>
#include <GLES2/gl2ext.h>
diff --git a/src/debug/crash/CrashReporter.cpp b/src/debug/crash/CrashReporter.cpp
index 1b18fce4..fad6ad21 100644
--- a/src/debug/crash/CrashReporter.cpp
+++ b/src/debug/crash/CrashReporter.cpp
@@ -248,5 +248,5 @@ void CrashReporter::createAndSaveCrash(int sig) {
finalCrashReport += "\n\nLog tail:\n";
- finalCrashReport += std::string_view(Debug::m_rollingLog).substr(Debug::m_rollingLog.find('\n') + 1);
+ finalCrashReport += Log::logger->rolling();
}
diff --git a/src/debug/log/Logger.cpp b/src/debug/log/Logger.cpp
new file mode 100644
index 00000000..44b82a50
--- /dev/null
+++ b/src/debug/log/Logger.cpp
@@ -0,0 +1,64 @@
+#include "Logger.hpp"
+#include "RollingLogFollow.hpp"
+
+#include "../../defines.hpp"
+
+#include "../../managers/HookSystemManager.hpp"
+#include "../../config/ConfigValue.hpp"
+
+using namespace Log;
+
+CLogger::CLogger() {
+ const auto IS_TRACE = Env::isTrace();
+ m_logger.setLogLevel(IS_TRACE ? Hyprutils::CLI::LOG_TRACE : Hyprutils::CLI::LOG_DEBUG);
+}
+
+void CLogger::log(Hyprutils::CLI::eLogLevel level, const std::string_view& str) {
+
+ static bool TRACE = Env::isTrace();
+
+ if (!m_logsEnabled)
+ return;
+
+ if (level == Hyprutils::CLI::LOG_TRACE && !TRACE)
+ return;
+
+ if (SRollingLogFollow::get().isRunning())
+ SRollingLogFollow::get().addLog(str);
+
+ m_logger.log(level, str);
+}
+
+void CLogger::initIS(const std::string_view& IS) {
+ // NOLINTNEXTLINE
+ m_logger.setOutputFile(std::string{IS} + (ISDEBUG ? "/hyprlandd.log" : "/hyprland.log"));
+ m_logger.setEnableRolling(true);
+ m_logger.setEnableColor(false);
+ m_logger.setEnableStdout(true);
+ m_logger.setTime(false);
+}
+
+void CLogger::initCallbacks() {
+ static auto P = g_pHookSystem->hookDynamic("configReloaded", [this](void* hk, SCallbackInfo& info, std::any param) { recheckCfg(); });
+ recheckCfg();
+}
+
+void CLogger::recheckCfg() {
+ static auto PDISABLELOGS = CConfigValue<Hyprlang::INT>("debug:disable_logs");
+ static auto PDISABLETIME = CConfigValue<Hyprlang::INT>("debug:disable_time");
+ static auto PENABLESTDOUT = CConfigValue<Hyprlang::INT>("debug:enable_stdout_logs");
+ static auto PENABLECOLOR = CConfigValue<Hyprlang::INT>("debug:colored_stdout_logs");
+
+ m_logger.setEnableStdout(!*PDISABLELOGS && *PENABLESTDOUT);
+ m_logsEnabled = !*PDISABLELOGS;
+ m_logger.setTime(!*PDISABLETIME);
+ m_logger.setEnableColor(*PENABLECOLOR);
+}
+
+const std::string& CLogger::rolling() {
+ return m_logger.rollingLog();
+}
+
+Hyprutils::CLI::CLogger& CLogger::hu() {
+ return m_logger;
+}
diff --git a/src/debug/log/Logger.hpp b/src/debug/log/Logger.hpp
new file mode 100644
index 00000000..d4e868de
--- /dev/null
+++ b/src/debug/log/Logger.hpp
@@ -0,0 +1,61 @@
+#pragma once
+
+#include <hyprutils/cli/Logger.hpp>
+
+#include "../../helpers/memory/Memory.hpp"
+#include "../../helpers/env/Env.hpp"
+
+namespace Log {
+ class CLogger {
+ public:
+ CLogger();
+ ~CLogger() = default;
+
+ void initIS(const std::string_view& IS);
+ void initCallbacks();
+
+ void log(Hyprutils::CLI::eLogLevel level, const std::string_view& str);
+
+ template <typename... Args>
+ //NOLINTNEXTLINE
+ void log(Hyprutils::CLI::eLogLevel level, std::format_string<Args...> fmt, Args&&... args) {
+ static bool TRACE = Env::isTrace();
+
+ if (!m_logsEnabled)
+ return;
+
+ if (level == Hyprutils::CLI::LOG_TRACE && !TRACE)
+ return;
+
+ std::string logMsg = "";
+
+ // no need for try {} catch {} because std::format_string<Args...> ensures that vformat never throw std::format_error
+ // because
+ // 1. any faulty format specifier that sucks will cause a compilation error.
+ // 2. and `std::bad_alloc` is catastrophic, (Almost any operation in stdlib could throw this.)
+ // 3. this is actually what std::format in stdlib does
+ logMsg += std::vformat(fmt.get(), std::make_format_args(args...));
+
+ log(level, logMsg);
+ }
+
+ const std::string& rolling();
+ Hyprutils::CLI::CLogger& hu();
+
+ private:
+ void recheckCfg();
+
+ Hyprutils::CLI::CLogger m_logger;
+ bool m_logsEnabled = true;
+ };
+
+ inline UP<CLogger> logger = makeUnique<CLogger>();
+
+ //
+ inline constexpr const Hyprutils::CLI::eLogLevel DEBUG = Hyprutils::CLI::LOG_DEBUG;
+ inline constexpr const Hyprutils::CLI::eLogLevel WARN = Hyprutils::CLI::LOG_WARN;
+ inline constexpr const Hyprutils::CLI::eLogLevel ERR = Hyprutils::CLI::LOG_ERR;
+ inline constexpr const Hyprutils::CLI::eLogLevel CRIT = Hyprutils::CLI::LOG_CRIT;
+ inline constexpr const Hyprutils::CLI::eLogLevel INFO = Hyprutils::CLI::LOG_DEBUG;
+ inline constexpr const Hyprutils::CLI::eLogLevel TRACE = Hyprutils::CLI::LOG_TRACE;
+};
diff --git a/src/debug/RollingLogFollow.hpp b/src/debug/log/RollingLogFollow.hpp
index 07b4387d..c1cce9eb 100644
--- a/src/debug/RollingLogFollow.hpp
+++ b/src/debug/log/RollingLogFollow.hpp
@@ -1,9 +1,11 @@
#pragma once
#include <shared_mutex>
+#include <unordered_map>
+#include <format>
+#include <vector>
-// NOLINTNEXTLINE(readability-identifier-naming)
-namespace Debug {
+namespace Log {
struct SRollingLogFollow {
std::unordered_map<int, std::string> m_socketToRollingLogFollowQueue;
std::shared_mutex m_mutex;
@@ -30,12 +32,14 @@ namespace Debug {
return ret;
};
- void addLog(const std::string& log) {
+ void addLog(const std::string_view& log) {
std::unique_lock<std::shared_mutex> w(m_mutex);
m_running = true;
std::vector<int> to_erase;
- for (const auto& p : m_socketToRollingLogFollowQueue)
- m_socketToRollingLogFollowQueue[p.first] += log + "\n";
+ for (const auto& p : m_socketToRollingLogFollowQueue) {
+ m_socketToRollingLogFollowQueue[p.first] += log;
+ m_socketToRollingLogFollowQueue[p.first] += "\n";
+ }
}
bool isRunning() {
diff --git a/src/defines.hpp b/src/defines.hpp
index 5c70f21a..cd4c524d 100644
--- a/src/defines.hpp
+++ b/src/defines.hpp
@@ -1,7 +1,7 @@
#pragma once
#include "includes.hpp"
-#include "debug/Log.hpp"
+#include "debug/log/Logger.hpp"
#include "helpers/Color.hpp"
#include "macros.hpp"
#include "desktop/DesktopTypes.hpp"
diff --git a/src/desktop/Workspace.cpp b/src/desktop/Workspace.cpp
index 7e1dcd5b..cbb584b6 100644
--- a/src/desktop/Workspace.cpp
+++ b/src/desktop/Workspace.cpp
@@ -60,7 +60,7 @@ SWorkspaceIDName CWorkspace::getPrevWorkspaceIDName() const {
}
CWorkspace::~CWorkspace() {
- Debug::log(LOG, "Destroying workspace ID {}", m_id);
+ Log::logger->log(Log::DEBUG, "Destroying workspace ID {}", m_id);
// check if g_pHookSystem and g_pEventManager exist, they might be destroyed as in when the compositor is closing.
if (g_pHookSystem)
@@ -90,7 +90,7 @@ void CWorkspace::rememberPrevWorkspace(const PHLWORKSPACE& prev) {
}
if (prev->m_id == m_id) {
- Debug::log(LOG, "Tried to set prev workspace to the same as current one");
+ Log::logger->log(Log::DEBUG, "Tried to set prev workspace to the same as current one");
return;
}
@@ -156,14 +156,14 @@ bool CWorkspace::matchesStaticSelector(const std::string& selector_) {
if (cur == 'r') {
WORKSPACEID from = 0, to = 0;
if (!prop.starts_with("r[") || !prop.ends_with("]")) {
- Debug::log(LOG, "Invalid selector {}", selector);
+ Log::logger->log(Log::DEBUG, "Invalid selector {}", selector);
return false;
}
prop = prop.substr(2, prop.length() - 3);
if (!prop.contains("-")) {
- Debug::log(LOG, "Invalid selector {}", selector);
+ Log::logger->log(Log::DEBUG, "Invalid selector {}", selector);
return false;
}
@@ -171,7 +171,7 @@ bool CWorkspace::matchesStaticSelector(const std::string& selector_) {
const auto LHS = prop.substr(0, DASHPOS), RHS = prop.substr(DASHPOS + 1);
if (!isNumber(LHS) || !isNumber(RHS)) {
- Debug::log(LOG, "Invalid selector {}", selector);
+ Log::logger->log(Log::DEBUG, "Invalid selector {}", selector);
return false;
}
@@ -179,12 +179,12 @@ bool CWorkspace::matchesStaticSelector(const std::string& selector_) {
from = std::stoll(LHS);
to = std::stoll(RHS);
} catch (std::exception& e) {
- Debug::log(LOG, "Invalid selector {}", selector);
+ Log::logger->log(Log::DEBUG, "Invalid selector {}", selector);
return false;
}
if (to < from || to < 1 || from < 1) {
- Debug::log(LOG, "Invalid selector {}", selector);
+ Log::logger->log(Log::DEBUG, "Invalid selector {}", selector);
return false;
}
@@ -195,7 +195,7 @@ bool CWorkspace::matchesStaticSelector(const std::string& selector_) {
if (cur == 's') {
if (!prop.starts_with("s[") || !prop.ends_with("]")) {
- Debug::log(LOG, "Invalid selector {}", selector);
+ Log::logger->log(Log::DEBUG, "Invalid selector {}", selector);
return false;
}
@@ -210,7 +210,7 @@ bool CWorkspace::matchesStaticSelector(const std::string& selector_) {
if (cur == 'm') {
if (!prop.starts_with("m[") || !prop.ends_with("]")) {
- Debug::log(LOG, "Invalid selector {}", selector);
+ Log::logger->log(Log::DEBUG, "Invalid selector {}", selector);
return false;
}
@@ -225,7 +225,7 @@ bool CWorkspace::matchesStaticSelector(const std::string& selector_) {
if (cur == 'n') {
if (!prop.starts_with("n[") || !prop.ends_with("]")) {
- Debug::log(LOG, "Invalid selector {}", selector);
+ Log::logger->log(Log::DEBUG, "Invalid selector {}", selector);
return false;
}
@@ -246,7 +246,7 @@ bool CWorkspace::matchesStaticSelector(const std::string& selector_) {
if (cur == 'w') {
WORKSPACEID from = 0, to = 0;
if (!prop.starts_with("w[") || !prop.ends_with("]")) {
- Debug::log(LOG, "Invalid selector {}", selector);
+ Log::logger->log(Log::DEBUG, "Invalid selector {}", selector);
return false;
}
@@ -284,14 +284,14 @@ bool CWorkspace::matchesStaticSelector(const std::string& selector_) {
// try single
if (!isNumber(prop)) {
- Debug::log(LOG, "Invalid selector {}", selector);
+ Log::logger->log(Log::DEBUG, "Invalid selector {}", selector);
return false;
}
try {
from = std::stoll(prop);
} catch (std::exception& e) {
- Debug::log(LOG, "Invalid selector {}", selector);
+ Log::logger->log(Log::DEBUG, "Invalid selector {}", selector);
return false;
}
@@ -314,7 +314,7 @@ bool CWorkspace::matchesStaticSelector(const std::string& selector_) {
const auto LHS = prop.substr(0, DASHPOS), RHS = prop.substr(DASHPOS + 1);
if (!isNumber(LHS) || !isNumber(RHS)) {
- Debug::log(LOG, "Invalid selector {}", selector);
+ Log::logger->log(Log::DEBUG, "Invalid selector {}", selector);
return false;
}
@@ -322,12 +322,12 @@ bool CWorkspace::matchesStaticSelector(const std::string& selector_) {
from = std::stoll(LHS);
to = std::stoll(RHS);
} catch (std::exception& e) {
- Debug::log(LOG, "Invalid selector {}", selector);
+ Log::logger->log(Log::DEBUG, "Invalid selector {}", selector);
return false;
}
if (to < from || to < 1 || from < 1) {
- Debug::log(LOG, "Invalid selector {}", selector);
+ Log::logger->log(Log::DEBUG, "Invalid selector {}", selector);
return false;
}
@@ -348,7 +348,7 @@ bool CWorkspace::matchesStaticSelector(const std::string& selector_) {
if (cur == 'f') {
if (!prop.starts_with("f[") || !prop.ends_with("]")) {
- Debug::log(LOG, "Invalid selector {}", selector);
+ Log::logger->log(Log::DEBUG, "Invalid selector {}", selector);
return false;
}
@@ -357,7 +357,7 @@ bool CWorkspace::matchesStaticSelector(const std::string& selector_) {
try {
FSSTATE = std::stoi(prop);
} catch (std::exception& e) {
- Debug::log(LOG, "Invalid selector {}", selector);
+ Log::logger->log(Log::DEBUG, "Invalid selector {}", selector);
return false;
}
@@ -379,7 +379,7 @@ bool CWorkspace::matchesStaticSelector(const std::string& selector_) {
continue;
}
- Debug::log(LOG, "Invalid selector {}", selector);
+ Log::logger->log(Log::DEBUG, "Invalid selector {}", selector);
return false;
}
@@ -522,7 +522,7 @@ void CWorkspace::rename(const std::string& name) {
if (g_pCompositor->isWorkspaceSpecial(m_id))
return;
- Debug::log(LOG, "CWorkspace::rename: Renaming workspace {} to '{}'", m_id, name);
+ Log::logger->log(Log::DEBUG, "CWorkspace::rename: Renaming workspace {} to '{}'", m_id, name);
m_name = name;
const auto WORKSPACERULE = g_pConfigManager->getWorkspaceRuleFor(m_self.lock());
diff --git a/src/desktop/rule/Rule.cpp b/src/desktop/rule/Rule.cpp
index fe7271a6..3d981587 100644
--- a/src/desktop/rule/Rule.cpp
+++ b/src/desktop/rule/Rule.cpp
@@ -1,5 +1,5 @@
#include "Rule.hpp"
-#include "../../debug/Log.hpp"
+#include "../../debug/log/Logger.hpp"
#include <re2/re2.h>
#include "matchEngine/RegexMatchEngine.hpp"
@@ -84,7 +84,7 @@ IRule::IRule(const std::string& name) : m_name(name) {
void IRule::registerMatch(eRuleProperty p, const std::string& s) {
if (!RULE_ENGINES.contains(p)) {
- Debug::log(ERR, "BUG THIS: IRule: RULE_ENGINES does not contain rule idx {}", sc<std::underlying_type_t<eRuleProperty>>(p));
+ Log::logger->log(Log::ERR, "BUG THIS: IRule: RULE_ENGINES does not contain rule idx {}", sc<std::underlying_type_t<eRuleProperty>>(p));
return;
}
diff --git a/src/desktop/rule/layerRule/LayerRule.cpp b/src/desktop/rule/layerRule/LayerRule.cpp
index 0356157f..eccd9914 100644
--- a/src/desktop/rule/layerRule/LayerRule.cpp
+++ b/src/desktop/rule/layerRule/LayerRule.cpp
@@ -1,5 +1,5 @@
#include "LayerRule.hpp"
-#include "../../../debug/Log.hpp"
+#include "../../../debug/log/Logger.hpp"
#include "../../view/LayerSurface.hpp"
using namespace Desktop;
@@ -28,7 +28,7 @@ bool CLayerRule::matches(PHLLS ls) {
for (const auto& [prop, engine] : m_matchEngines) {
switch (prop) {
default: {
- Debug::log(TRACE, "CLayerRule::matches: skipping prop entry {}", sc<std::underlying_type_t<eRuleProperty>>(prop));
+ Log::logger->log(Log::TRACE, "CLayerRule::matches: skipping prop entry {}", sc<std::underlying_type_t<eRuleProperty>>(prop));
break;
}
diff --git a/src/desktop/rule/layerRule/LayerRuleApplicator.cpp b/src/desktop/rule/layerRule/LayerRuleApplicator.cpp
index 11e5c137..d80f839c 100644
--- a/src/desktop/rule/layerRule/LayerRuleApplicator.cpp
+++ b/src/desktop/rule/layerRule/LayerRuleApplicator.cpp
@@ -38,7 +38,7 @@ void CLayerRuleApplicator::applyDynamicRule(const SP<CLayerRule>& rule) {
for (const auto& [key, effect] : rule->effects()) {
switch (key) {
case LAYER_RULE_EFFECT_NONE: {
- Debug::log(ERR, "CLayerRuleApplicator::applyDynamicRule: BUG THIS: LAYER_RULE_EFFECT_NONE??");
+ Log::logger->log(Log::ERR, "CLayerRuleApplicator::applyDynamicRule: BUG THIS: LAYER_RULE_EFFECT_NONE??");
break;
}
case LAYER_RULE_EFFECT_NO_ANIM: {
@@ -75,21 +75,21 @@ void CLayerRuleApplicator::applyDynamicRule(const SP<CLayerRule>& rule) {
try {
m_noScreenShare.first.set(std::stoi(effect), Types::PRIORITY_WINDOW_RULE);
m_noScreenShare.second |= rule->getPropertiesMask();
- } catch (...) { Debug::log(ERR, "CLayerRuleApplicator::applyDynamicRule: invalid order {}", effect); }
+ } catch (...) { Log::logger->log(Log::ERR, "CLayerRuleApplicator::applyDynamicRule: invalid order {}", effect); }
break;
}
case LAYER_RULE_EFFECT_ABOVE_LOCK: {
try {
m_aboveLock.first.set(std::clamp(std::stoull(effect), 0ULL, 2ULL), Types::PRIORITY_WINDOW_RULE);
m_aboveLock.second |= rule->getPropertiesMask();
- } catch (...) { Debug::log(ERR, "CLayerRuleApplicator::applyDynamicRule: invalid order {}", effect); }
+ } catch (...) { Log::logger->log(Log::ERR, "CLayerRuleApplicator::applyDynamicRule: invalid order {}", effect); }
break;
}
case LAYER_RULE_EFFECT_IGNORE_ALPHA: {
try {
m_ignoreAlpha.first.set(std::clamp(std::stof(effect), 0.F, 1.F), Types::PRIORITY_WINDOW_RULE);
m_ignoreAlpha.second |= rule->getPropertiesMask();
- } catch (...) { Debug::log(ERR, "CLayerRuleApplicator::applyDynamicRule: invalid order {}", effect); }
+ } catch (...) { Log::logger->log(Log::ERR, "CLayerRuleApplicator::applyDynamicRule: invalid order {}", effect); }
break;
}
case LAYER_RULE_EFFECT_ANIMATION: {
diff --git a/src/desktop/rule/matchEngine/IntMatchEngine.cpp b/src/desktop/rule/matchEngine/IntMatchEngine.cpp
index c5bc87f6..c8f3c09e 100644
--- a/src/desktop/rule/matchEngine/IntMatchEngine.cpp
+++ b/src/desktop/rule/matchEngine/IntMatchEngine.cpp
@@ -1,12 +1,12 @@
#include "IntMatchEngine.hpp"
-#include "../../../debug/Log.hpp"
+#include "../../../debug/log/Logger.hpp"
using namespace Desktop::Rule;
CIntMatchEngine::CIntMatchEngine(const std::string& s) {
try {
m_value = std::stoi(s);
- } catch (...) { Debug::log(ERR, "CIntMatchEngine: invalid input {}", s); }
+ } catch (...) { Log::logger->log(Log::ERR, "CIntMatchEngine: invalid input {}", s); }
}
bool CIntMatchEngine::match(int other) {
diff --git a/src/desktop/rule/windowRule/WindowRule.cpp b/src/desktop/rule/windowRule/WindowRule.cpp
index 7fb289fa..d1994d2e 100644
--- a/src/desktop/rule/windowRule/WindowRule.cpp
+++ b/src/desktop/rule/windowRule/WindowRule.cpp
@@ -32,7 +32,7 @@ bool CWindowRule::matches(PHLWINDOW w, bool allowEnvLookup) {
for (const auto& [prop, engine] : m_matchEngines) {
switch (prop) {
default: {
- Debug::log(TRACE, "CWindowRule::matches: skipping prop entry {}", sc<std::underlying_type_t<eRuleProperty>>(prop));
+ Log::logger->log(Log::TRACE, "CWindowRule::matches: skipping prop entry {}", sc<std::underlying_type_t<eRuleProperty>>(prop));
break;
}
diff --git a/src/desktop/rule/windowRule/WindowRuleApplicator.cpp b/src/desktop/rule/windowRule/WindowRuleApplicator.cpp
index 6b2d1b94..ab1c2a14 100644
--- a/src/desktop/rule/windowRule/WindowRuleApplicator.cpp
+++ b/src/desktop/rule/windowRule/WindowRuleApplicator.cpp
@@ -96,7 +96,7 @@ CWindowRuleApplicator::SRuleResult CWindowRuleApplicator::applyDynamicRule(const
switch (key) {
default: {
if (key <= WINDOW_RULE_EFFECT_LAST_STATIC) {
- Debug::log(TRACE, "CWindowRuleApplicator::applyDynamicRule: Skipping effect {}, not dynamic", sc<std::underlying_type_t<eWindowRuleEffect>>(key));
+ Log::logger->log(Log::TRACE, "CWindowRuleApplicator::applyDynamicRule: Skipping effect {}, not dynamic", sc<std::underlying_type_t<eWindowRuleEffect>>(key));
break;
}
@@ -118,21 +118,21 @@ CWindowRuleApplicator::SRuleResult CWindowRuleApplicator::applyDynamicRule(const
}
case WINDOW_RULE_EFFECT_NONE: {
- Debug::log(ERR, "CWindowRuleApplicator::applyDynamicRule: BUG THIS: WINDOW_RULE_EFFECT_NONE??");
+ Log::logger->log(Log::ERR, "CWindowRuleApplicator::applyDynamicRule: BUG THIS: WINDOW_RULE_EFFECT_NONE??");
break;
}
case WINDOW_RULE_EFFECT_ROUNDING: {
try {
m_rounding.first.set(std::stoull(effect), Types::PRIORITY_WINDOW_RULE);
m_rounding.second |= rule->getPropertiesMask();
- } catch (...) { Debug::log(ERR, "CWindowRuleApplicator::applyDynamicRule: invalid rounding {}", effect); }
+ } catch (...) { Log::logger->log(Log::ERR, "CWindowRuleApplicator::applyDynamicRule: invalid rounding {}", effect); }
break;
}
case WINDOW_RULE_EFFECT_ROUNDING_POWER: {
try {
m_roundingPower.first.set(std::clamp(std::stof(effect), 1.F, 10.F), Types::PRIORITY_WINDOW_RULE);
m_roundingPower.second |= rule->getPropertiesMask();
- } catch (...) { Debug::log(ERR, "CWindowRuleApplicator::applyDynamicRule: invalid rounding_power {}", effect); }
+ } catch (...) { Log::logger->log(Log::ERR, "CWindowRuleApplicator::applyDynamicRule: invalid rounding_power {}", effect); }
break;
}
case WINDOW_RULE_EFFECT_PERSISTENT_SIZE: {
@@ -179,16 +179,16 @@ CWindowRuleApplicator::SRuleResult CWindowRuleApplicator::applyDynamicRule(const
// Includes sanity checks for the number of colors in each gradient
if (activeBorderGradient.m_colors.size() > 10 || inactiveBorderGradient.m_colors.size() > 10)
- Debug::log(WARN, "Bordercolor rule \"{}\" has more than 10 colors in one gradient, ignoring", effect);
+ Log::logger->log(Log::WARN, "Bordercolor rule \"{}\" has more than 10 colors in one gradient, ignoring", effect);
else if (activeBorderGradient.m_colors.empty())
- Debug::log(WARN, "Bordercolor rule \"{}\" has no colors, ignoring", effect);
+ Log::logger->log(Log::WARN, "Bordercolor rule \"{}\" has no colors, ignoring", effect);
else if (inactiveBorderGradient.m_colors.empty())
m_activeBorderColor.first = Types::COverridableVar(activeBorderGradient, Types::PRIORITY_WINDOW_RULE);
else {
m_activeBorderColor.first = Types::COverridableVar(activeBorderGradient, Types::PRIORITY_WINDOW_RULE);
m_inactiveBorderColor.first = Types::COverridableVar(inactiveBorderGradient, Types::PRIORITY_WINDOW_RULE);
}
- } catch (std::exception& e) { Debug::log(ERR, "BorderColor rule \"{}\" failed with: {}", effect, e.what()); }
+ } catch (std::exception& e) { Log::logger->log(Log::ERR, "BorderColor rule \"{}\" failed with: {}", effect, e.what()); }
m_activeBorderColor.second = rule->getPropertiesMask();
m_inactiveBorderColor.second = rule->getPropertiesMask();
break;
@@ -203,7 +203,7 @@ CWindowRuleApplicator::SRuleResult CWindowRuleApplicator::applyDynamicRule(const
else if (effect == "fullscreen")
m_idleInhibitMode.first.set(IDLEINHIBIT_FULLSCREEN, Types::PRIORITY_WINDOW_RULE);
else
- Debug::log(ERR, "Rule idleinhibit: unknown mode {}", effect);
+ Log::logger->log(Log::ERR, "Rule idleinhibit: unknown mode {}", effect);
m_idleInhibitMode.second = rule->getPropertiesMask();
break;
}
@@ -246,7 +246,7 @@ CWindowRuleApplicator::SRuleResult CWindowRuleApplicator::applyDynamicRule(const
m_alphaInactive.first = m_alpha.first;
m_alphaFullscreen.first = m_alpha.first;
}
- } catch (std::exception& e) { Debug::log(ERR, "Opacity rule \"{}\" failed with: {}", effect, e.what()); }
+ } catch (std::exception& e) { Log::logger->log(Log::ERR, "Opacity rule \"{}\" failed with: {}", effect, e.what()); }
m_alpha.second = rule->getPropertiesMask();
m_alphaInactive.second = rule->getPropertiesMask();
m_alphaFullscreen.second = rule->getPropertiesMask();
@@ -270,14 +270,14 @@ CWindowRuleApplicator::SRuleResult CWindowRuleApplicator::applyDynamicRule(const
const auto VEC = configStringToVector2D(effect);
if (VEC.x < 1 || VEC.y < 1) {
- Debug::log(ERR, "Invalid size for maxsize");
+ Log::logger->log(Log::ERR, "Invalid size for maxsize");
break;
}
m_maxSize.first = Types::COverridableVar(VEC, Types::PRIORITY_WINDOW_RULE);
m_window->clampWindowSize(std::nullopt, m_maxSize.first.value());
- } catch (std::exception& e) { Debug::log(ERR, "maxsize rule \"{}\" failed with: {}", effect, e.what()); }
+ } catch (std::exception& e) { Log::logger->log(Log::ERR, "maxsize rule \"{}\" failed with: {}", effect, e.what()); }
m_maxSize.second = rule->getPropertiesMask();
break;
}
@@ -293,13 +293,13 @@ CWindowRuleApplicator::SRuleResult CWindowRuleApplicator::applyDynamicRule(const
const auto VEC = configStringToVector2D(effect);
if (VEC.x < 1 || VEC.y < 1) {
- Debug::log(ERR, "Invalid size for maxsize");
+ Log::logger->log(Log::ERR, "Invalid size for maxsize");
break;
}
m_minSize.first = Types::COverridableVar(VEC, Types::PRIORITY_WINDOW_RULE);
m_window->clampWindowSize(std::nullopt, m_minSize.first.value());
- } catch (std::exception& e) { Debug::log(ERR, "minsize rule \"{}\" failed with: {}", effect, e.what()); }
+ } catch (std::exception& e) { Log::logger->log(Log::ERR, "minsize rule \"{}\" failed with: {}", effect, e.what()); }
m_minSize.second = rule->getPropertiesMask();
break;
}
@@ -310,7 +310,7 @@ CWindowRuleApplicator::SRuleResult CWindowRuleApplicator::applyDynamicRule(const
m_borderSize.second |= rule->getPropertiesMask();
if (oldBorderSize != m_borderSize.first.valueOrDefault())
result.needsRelayout = true;
- } catch (...) { Debug::log(ERR, "CWindowRuleApplicator::applyDynamicRule: invalid border_size {}", effect); }
+ } catch (...) { Log::logger->log(Log::ERR, "CWindowRuleApplicator::applyDynamicRule: invalid border_size {}", effect); }
break;
}
case WINDOW_RULE_EFFECT_ALLOWS_INPUT: {
@@ -432,14 +432,14 @@ CWindowRuleApplicator::SRuleResult CWindowRuleApplicator::applyDynamicRule(const
try {
m_scrollMouse.first.set(std::clamp(std::stof(effect), 0.01F, 10.F), Types::PRIORITY_WINDOW_RULE);
m_scrollMouse.second |= rule->getPropertiesMask();
- } catch (...) { Debug::log(ERR, "CWindowRuleApplicator::applyDynamicRule: invalid scroll_mouse {}", effect); }
+ } catch (...) { Log::logger->log(Log::ERR, "CWindowRuleApplicator::applyDynamicRule: invalid scroll_mouse {}", effect); }
break;
}
case WINDOW_RULE_EFFECT_SCROLL_TOUCHPAD: {
try {
m_scrollTouchpad.first.set(std::clamp(std::stof(effect), 0.01F, 10.F), Types::PRIORITY_WINDOW_RULE);
m_scrollTouchpad.second |= rule->getPropertiesMask();
- } catch (...) { Debug::log(ERR, "CWindowRuleApplicator::applyDynamicRule: invalid scroll_touchpad {}", effect); }
+ } catch (...) { Log::logger->log(Log::ERR, "CWindowRuleApplicator::applyDynamicRule: invalid scroll_touchpad {}", effect); }
break;
}
}
@@ -451,7 +451,7 @@ CWindowRuleApplicator::SRuleResult CWindowRuleApplicator::applyStaticRule(const
for (const auto& [key, effect] : rule->effects()) {
switch (key) {
default: {
- Debug::log(TRACE, "CWindowRuleApplicator::applyStaticRule: Skipping effect {}, not static", sc<std::underlying_type_t<eWindowRuleEffect>>(key));
+ Log::logger->log(Log::TRACE, "CWindowRuleApplicator::applyStaticRule: Skipping effect {}, not static", sc<std::underlying_type_t<eWindowRuleEffect>>(key));
break;
}
@@ -477,7 +477,7 @@ CWindowRuleApplicator::SRuleResult CWindowRuleApplicator::applyStaticRule(const
static_.fullscreenStateInternal = std::stoi(std::string{vars[0]});
if (!vars[1].empty())
static_.fullscreenStateClient = std::stoi(std::string{vars[1]});
- } catch (...) { Debug::log(ERR, "CWindowRuleApplicator::applyStaticRule: invalid fullscreen state {}", effect); }
+ } catch (...) { Log::logger->log(Log::ERR, "CWindowRuleApplicator::applyStaticRule: invalid fullscreen state {}", effect); }
break;
}
case WINDOW_RULE_EFFECT_MOVE: {
@@ -532,7 +532,7 @@ CWindowRuleApplicator::SRuleResult CWindowRuleApplicator::applyStaticRule(const
case WINDOW_RULE_EFFECT_NOCLOSEFOR: {
try {
static_.noCloseFor = std::stoi(effect);
- } catch (...) { Debug::log(ERR, "CWindowRuleApplicator::applyStaticRule: invalid no close for {}", effect); }
+ } catch (...) { Log::logger->log(Log::ERR, "CWindowRuleApplicator::applyStaticRule: invalid no close for {}", effect); }
break;
}
}
diff --git a/src/desktop/state/FocusState.cpp b/src/desktop/state/FocusState.cpp
index 1bb231aa..ea869398 100644
--- a/src/desktop/state/FocusState.cpp
+++ b/src/desktop/state/FocusState.cpp
@@ -67,7 +67,7 @@ static SFullscreenWorkspaceFocusResult onFullscreenWorkspaceFocusWindow(PHLWINDO
g_pCompositor->setWindowFullscreenInternal(pWindow, FSMODE);
break;
- default: Debug::log(ERR, "Invalid misc:on_focus_under_fullscreen mode: {}", *PONFOCUSUNDERFS); break;
+ default: Log::logger->log(Log::ERR, "Invalid misc:on_focus_under_fullscreen mode: {}", *PONFOCUSUNDERFS); break;
}
return {};
@@ -89,7 +89,7 @@ void CFocusState::fullWindowFocus(PHLWINDOW pWindow, SP<CWLSurfaceResource> surf
static auto PMODALPARENTBLOCKING = CConfigValue<Hyprlang::INT>("general:modal_parent_blocking");
if (*PMODALPARENTBLOCKING && pWindow && pWindow->m_xdgSurface && pWindow->m_xdgSurface->m_toplevel && pWindow->m_xdgSurface->m_toplevel->anyChildModal()) {
- Debug::log(LOG, "Refusing focus to window shadowed by modal dialog");
+ Log::logger->log(Log::DEBUG, "Refusing focus to window shadowed by modal dialog");
return;
}
@@ -102,12 +102,12 @@ void CFocusState::rawWindowFocus(PHLWINDOW pWindow, SP<CWLSurfaceResource> surfa
if (!pWindow || !pWindow->priorityFocus()) {
if (g_pSessionLockManager->isSessionLocked()) {
- Debug::log(LOG, "Refusing a keyboard focus to a window because of a sessionlock");
+ Log::logger->log(Log::DEBUG, "Refusing a keyboard focus to a window because of a sessionlock");
return;
}
if (!g_pInputManager->m_exclusiveLSes.empty()) {
- Debug::log(LOG, "Refusing a keyboard focus to a window because of an exclusive ls");
+ Log::logger->log(Log::DEBUG, "Refusing a keyboard focus to a window because of an exclusive ls");
return;
}
}
@@ -148,7 +148,7 @@ void CFocusState::rawWindowFocus(PHLWINDOW pWindow, SP<CWLSurfaceResource> surfa
}
if (pWindow->m_ruleApplicator->noFocus().valueOrDefault()) {
- Debug::log(LOG, "Ignoring focus to nofocus window!");
+ Log::logger->log(Log::DEBUG, "Ignoring focus to nofocus window!");
return;
}
@@ -234,7 +234,7 @@ void CFocusState::rawSurfaceFocus(SP<CWLSurfaceResource> pSurface, PHLWINDOW pWi
return;
if (g_pSeatManager->m_seatGrab && !g_pSeatManager->m_seatGrab->accepts(pSurface)) {
- Debug::log(LOG, "surface {:x} won't receive kb focus because grab rejected it", rc<uintptr_t>(pSurface.get()));
+ Log::logger->log(Log::DEBUG, "surface {:x} won't receive kb focus because grab rejected it", rc<uintptr_t>(pSurface.get()));
return;
}
@@ -257,9 +257,9 @@ void CFocusState::rawSurfaceFocus(SP<CWLSurfaceResource> pSurface, PHLWINDOW pWi
g_pSeatManager->setKeyboardFocus(pSurface);
if (pWindowOwner)
- Debug::log(LOG, "Set keyboard focus to surface {:x}, with {}", rc<uintptr_t>(pSurface.get()), pWindowOwner);
+ Log::logger->log(Log::DEBUG, "Set keyboard focus to surface {:x}, with {}", rc<uintptr_t>(pSurface.get()), pWindowOwner);
else
- Debug::log(LOG, "Set keyboard focus to surface {:x}", rc<uintptr_t>(pSurface.get()));
+ Log::logger->log(Log::DEBUG, "Set keyboard focus to surface {:x}", rc<uintptr_t>(pSurface.get()));
g_pXWaylandManager->activateSurface(pSurface, true);
m_focusSurface = pSurface;
@@ -324,7 +324,7 @@ void CFocusState::addWindowToHistory(PHLWINDOW w) {
void CFocusState::moveWindowToLatestInHistory(PHLWINDOW w) {
const auto HISTORYPIVOT = std::ranges::find_if(m_windowFocusHistory, [&w](const auto& other) { return other.lock() == w; });
if (HISTORYPIVOT == m_windowFocusHistory.end())
- Debug::log(TRACE, "CFocusState: {} has no pivot in history, ignoring request to move to latest", w);
+ Log::logger->log(Log::TRACE, "CFocusState: {} has no pivot in history, ignoring request to move to latest", w);
else
std::rotate(m_windowFocusHistory.begin(), HISTORYPIVOT, HISTORYPIVOT + 1);
}
diff --git a/src/desktop/view/LayerSurface.cpp b/src/desktop/view/LayerSurface.cpp
index 32d0ff61..7c65c972 100644
--- a/src/desktop/view/LayerSurface.cpp
+++ b/src/desktop/view/LayerSurface.cpp
@@ -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());
diff --git a/src/desktop/view/Popup.cpp b/src/desktop/view/Popup.cpp
index bb409953..841674e7 100644
--- a/src/desktop/view/Popup.cpp
+++ b/src/desktop/view/Popup.cpp
@@ -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;
diff --git a/src/desktop/view/Subsurface.cpp b/src/desktop/view/Subsurface.cpp
index 2c39a083..c601c00e 100644
--- a/src/desktop/view/Subsurface.cpp
+++ b/src/desktop/view/Subsurface.cpp
@@ -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;
}
diff --git a/src/desktop/view/WLSurface.cpp b/src/desktop/view/WLSurface.cpp
index 8c3ce9db..9d46aad1 100644
--- a/src/desktop/view/WLSurface.cpp
+++ b/src/desktop/view/WLSurface.cpp
@@ -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 {
diff --git a/src/desktop/view/Window.cpp b/src/desktop/view/Window.cpp
index bf853557..bdb9affe 100644
--- a/src/desktop/view/Window.cpp
+++ b/src/desktop/view/Window.cpp
@@ -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));
diff --git a/src/devices/IKeyboard.cpp b/src/devices/IKeyboard.cpp
index b732ba08..ae6df1f5 100644
--- a/src/devices/IKeyboard.cpp
+++ b/src/devices/IKeyboard.cpp
@@ -56,7 +56,7 @@ void IKeyboard::clearManuallyAllocd() {
void IKeyboard::setKeymap(const SStringRuleNames& rules) {
if (m_keymapOverridden) {
- Debug::log(LOG, "Ignoring setKeymap: keymap is overridden");
+ Log::logger->log(Log::DEBUG, "Ignoring setKeymap: keymap is overridden");
return;
}
@@ -72,20 +72,20 @@ void IKeyboard::setKeymap(const SStringRuleNames& rules) {
const auto CONTEXT = xkb_context_new(XKB_CONTEXT_NO_FLAGS);
if (!CONTEXT) {
- Debug::log(ERR, "setKeymap: CONTEXT null??");
+ Log::logger->log(Log::ERR, "setKeymap: CONTEXT null??");
return;
}
clearManuallyAllocd();
- Debug::log(LOG, "Attempting to create a keymap for layout {} with variant {} (rules: {}, model: {}, options: {})", rules.layout, rules.variant, rules.rules, rules.model,
- rules.options);
+ Log::logger->log(Log::DEBUG, "Attempting to create a keymap for layout {} with variant {} (rules: {}, model: {}, options: {})", rules.layout, rules.variant, rules.rules,
+ rules.model, rules.options);
if (!m_xkbFilePath.empty()) {
auto path = absolutePath(m_xkbFilePath, g_pConfigManager->m_configCurrentPath);
if (FILE* const KEYMAPFILE = fopen(path.c_str(), "r"); !KEYMAPFILE)
- Debug::log(ERR, "Cannot open input:kb_file= file for reading");
+ Log::logger->log(Log::ERR, "Cannot open input:kb_file= file for reading");
else {
m_xkbKeymap = xkb_keymap_new_from_file(CONTEXT, KEYMAPFILE, XKB_KEYMAP_FORMAT_TEXT_V2, XKB_KEYMAP_COMPILE_NO_FLAGS);
fclose(KEYMAPFILE);
@@ -99,8 +99,8 @@ void IKeyboard::setKeymap(const SStringRuleNames& rules) {
g_pConfigManager->addParseError("Invalid keyboard layout passed. ( rules: " + rules.rules + ", model: " + rules.model + ", variant: " + rules.variant +
", options: " + rules.options + ", layout: " + rules.layout + " )");
- Debug::log(ERR, "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, "Keyboard layout {} with variant {} (rules: {}, model: {}, options: {}) couldn't have been loaded.", rules.layout, rules.variant, rules.rules,
+ rules.model, rules.options);
memset(&XKBRULES, 0, sizeof(XKBRULES));
m_currentRules.rules = "";
@@ -129,12 +129,12 @@ void IKeyboard::setKeymap(const SStringRuleNames& rules) {
for (size_t i = 0; i < std::min(LEDNAMES.size(), m_ledIndexes.size()); ++i) {
m_ledIndexes[i] = xkb_map_led_get_index(m_xkbKeymap, LEDNAMES[i]);
- Debug::log(LOG, "xkb: LED index {} (name {}) got index {}", i, LEDNAMES[i], m_ledIndexes[i]);
+ Log::logger->log(Log::DEBUG, "xkb: LED index {} (name {}) got index {}", i, LEDNAMES[i], m_ledIndexes[i]);
}
for (size_t i = 0; i < std::min(MODNAMES.size(), m_modIndexes.size()); ++i) {
m_modIndexes[i] = xkb_map_mod_get_index(m_xkbKeymap, MODNAMES[i]);
- Debug::log(LOG, "xkb: Mod index {} (name {}) got index {}", i, MODNAMES[i], m_modIndexes[i]);
+ Log::logger->log(Log::DEBUG, "xkb: Mod index {} (name {}) got index {}", i, MODNAMES[i], m_modIndexes[i]);
}
updateKeymapFD();
@@ -145,7 +145,7 @@ void IKeyboard::setKeymap(const SStringRuleNames& rules) {
}
void IKeyboard::updateKeymapFD() {
- Debug::log(LOG, "Updating keymap fd for keyboard {}", m_deviceName);
+ Log::logger->log(Log::DEBUG, "Updating keymap fd for keyboard {}", m_deviceName);
if (m_xkbKeymapFD.isValid())
m_xkbKeymapFD.reset();
@@ -162,11 +162,11 @@ void IKeyboard::updateKeymapFD() {
CFileDescriptor rw, ro, rwV1, roV1;
if (!allocateSHMFilePair(m_xkbKeymapString.length() + 1, rw, ro))
- Debug::log(ERR, "IKeyboard: failed to allocate shm pair for the keymap");
+ Log::logger->log(Log::ERR, "IKeyboard: failed to allocate shm pair for the keymap");
else if (!allocateSHMFilePair(m_xkbKeymapV1String.length() + 1, rwV1, roV1)) {
ro.reset();
rw.reset();
- Debug::log(ERR, "IKeyboard: failed to allocate shm pair for keymap V1");
+ Log::logger->log(Log::ERR, "IKeyboard: failed to allocate shm pair for keymap V1");
} else {
auto keymapFDDest = mmap(nullptr, m_xkbKeymapString.length() + 1, PROT_READ | PROT_WRITE, MAP_SHARED, rw.get(), 0);
auto keymapV1FDDest = mmap(nullptr, m_xkbKeymapV1String.length() + 1, PROT_READ | PROT_WRITE, MAP_SHARED, rwV1.get(), 0);
@@ -174,7 +174,7 @@ void IKeyboard::updateKeymapFD() {
rwV1.reset();
if (keymapFDDest == MAP_FAILED || keymapV1FDDest == MAP_FAILED) {
- Debug::log(ERR, "IKeyboard: failed to mmap a shm pair for the keymap");
+ Log::logger->log(Log::ERR, "IKeyboard: failed to mmap a shm pair for the keymap");
ro.reset();
roV1.reset();
} else {
@@ -187,7 +187,7 @@ void IKeyboard::updateKeymapFD() {
}
}
- Debug::log(LOG, "Updated keymap fd to {}, keymap V1 to: {}", m_xkbKeymapFD.get(), m_xkbKeymapV1FD.get());
+ Log::logger->log(Log::DEBUG, "Updated keymap fd to {}, keymap V1 to: {}", m_xkbKeymapFD.get(), m_xkbKeymapV1FD.get());
}
void IKeyboard::updateXKBTranslationState(xkb_keymap* const keymap) {
@@ -206,7 +206,7 @@ void IKeyboard::updateXKBTranslationState(xkb_keymap* const keymap) {
m_xkbSymState = nullptr;
if (keymap) {
- Debug::log(LOG, "Updating keyboard {:x}'s translation state from a provided keymap", rc<uintptr_t>(this));
+ Log::logger->log(Log::DEBUG, "Updating keyboard {:x}'s translation state from a provided keymap", rc<uintptr_t>(this));
m_xkbStaticState = xkb_state_new(keymap);
m_xkbState = xkb_state_new(keymap);
m_xkbSymState = xkb_state_new(keymap);
@@ -221,7 +221,7 @@ void IKeyboard::updateXKBTranslationState(xkb_keymap* const keymap) {
for (uint32_t i = 0; i < LAYOUTSNUM; ++i) {
if (xkb_state_layout_index_is_active(STATE, i, XKB_STATE_LAYOUT_EFFECTIVE) == 1) {
- Debug::log(LOG, "Updating keyboard {:x}'s translation state from an active index {}", rc<uintptr_t>(this), i);
+ Log::logger->log(Log::DEBUG, "Updating keyboard {:x}'s translation state from an active index {}", rc<uintptr_t>(this), i);
CVarList keyboardLayouts(m_currentRules.layout, 0, ',');
CVarList keyboardModels(m_currentRules.model, 0, ',');
@@ -241,14 +241,14 @@ void IKeyboard::updateXKBTranslationState(xkb_keymap* const keymap) {
auto KEYMAP = xkb_keymap_new_from_names2(PCONTEXT, &rules, XKB_KEYMAP_FORMAT_TEXT_V2, XKB_KEYMAP_COMPILE_NO_FLAGS);
if (!KEYMAP) {
- Debug::log(ERR, "updateXKBTranslationState: keymap failed 1, fallback without model/variant");
+ Log::logger->log(Log::ERR, "updateXKBTranslationState: keymap failed 1, fallback without model/variant");
rules.model = "";
rules.variant = "";
KEYMAP = xkb_keymap_new_from_names2(PCONTEXT, &rules, XKB_KEYMAP_FORMAT_TEXT_V2, XKB_KEYMAP_COMPILE_NO_FLAGS);
}
if (!KEYMAP) {
- Debug::log(ERR, "updateXKBTranslationState: keymap failed 2, fallback to us");
+ Log::logger->log(Log::ERR, "updateXKBTranslationState: keymap failed 2, fallback to us");
rules.layout = "us";
KEYMAP = xkb_keymap_new_from_names2(PCONTEXT, &rules, XKB_KEYMAP_FORMAT_TEXT_V2, XKB_KEYMAP_COMPILE_NO_FLAGS);
}
@@ -264,7 +264,7 @@ void IKeyboard::updateXKBTranslationState(xkb_keymap* const keymap) {
}
}
- Debug::log(LOG, "Updating keyboard {:x}'s translation state from an unknown index", rc<uintptr_t>(this));
+ Log::logger->log(Log::DEBUG, "Updating keyboard {:x}'s translation state from an unknown index", rc<uintptr_t>(this));
xkb_rule_names rules = {
.rules = m_currentRules.rules.c_str(),
diff --git a/src/helpers/AsyncDialogBox.cpp b/src/helpers/AsyncDialogBox.cpp
index b3688680..4cef4252 100644
--- a/src/helpers/AsyncDialogBox.cpp
+++ b/src/helpers/AsyncDialogBox.cpp
@@ -12,7 +12,7 @@ static std::vector<std::pair<pid_t, WP<CAsyncDialogBox>>> asyncDialogBoxes;
//
SP<CAsyncDialogBox> CAsyncDialogBox::create(const std::string& title, const std::string& description, std::vector<std::string> buttons) {
if (!NFsUtils::executableExistsInPath("hyprland-dialog")) {
- Debug::log(ERR, "CAsyncDialogBox: cannot create, no hyprland-dialog");
+ Log::logger->log(Log::ERR, "CAsyncDialogBox: cannot create, no hyprland-dialog");
return nullptr;
}
@@ -63,7 +63,7 @@ void CAsyncDialogBox::onWrite(int fd, uint32_t mask) {
// TODO: can we avoid this without risking a blocking read()?
int fdFlags = fcntl(fd, F_GETFL, 0);
if (fcntl(fd, F_SETFL, fdFlags | O_NONBLOCK) < 0) {
- Debug::log(ERR, "CAsyncDialogBox::onWrite: fcntl 1 failed!");
+ Log::logger->log(Log::ERR, "CAsyncDialogBox::onWrite: fcntl 1 failed!");
return;
}
@@ -73,13 +73,13 @@ void CAsyncDialogBox::onWrite(int fd, uint32_t mask) {
// restore the flags (otherwise libwayland won't give us a hangup)
if (fcntl(fd, F_SETFL, fdFlags) < 0) {
- Debug::log(ERR, "CAsyncDialogBox::onWrite: fcntl 2 failed!");
+ Log::logger->log(Log::ERR, "CAsyncDialogBox::onWrite: fcntl 2 failed!");
return;
}
}
if (mask & (WL_EVENT_HANGUP | WL_EVENT_ERROR)) {
- Debug::log(LOG, "CAsyncDialogBox: dialog {:x} hung up, closed.");
+ Log::logger->log(Log::DEBUG, "CAsyncDialogBox: dialog {:x} hung up, closed.");
m_promiseResolver->resolve(m_stdout);
std::erase_if(asyncDialogBoxes, [this](const auto& e) { return e.first == m_dialogPid; });
@@ -102,7 +102,7 @@ SP<CPromise<std::string>> CAsyncDialogBox::open() {
int outPipe[2];
if (pipe(outPipe)) {
- Debug::log(ERR, "CAsyncDialogBox::open: failed to pipe()");
+ Log::logger->log(Log::ERR, "CAsyncDialogBox::open: failed to pipe()");
return nullptr;
}
@@ -113,14 +113,14 @@ SP<CPromise<std::string>> CAsyncDialogBox::open() {
m_readEventSource = wl_event_loop_add_fd(g_pEventLoopManager->m_wayland.loop, m_pipeReadFd.get(), WL_EVENT_READABLE, ::onFdWrite, this);
if (!m_readEventSource) {
- Debug::log(ERR, "CAsyncDialogBox::open: failed to add read fd to loop");
+ Log::logger->log(Log::ERR, "CAsyncDialogBox::open: failed to add read fd to loop");
return nullptr;
}
m_selfReference = m_selfWeakReference.lock();
if (!proc.runAsync()) {
- Debug::log(ERR, "CAsyncDialogBox::open: failed to run async");
+ Log::logger->log(Log::ERR, "CAsyncDialogBox::open: failed to run async");
wl_event_source_remove(m_readEventSource);
return nullptr;
}
diff --git a/src/helpers/Format.cpp b/src/helpers/Format.cpp
index ce64c113..37f77d78 100644
--- a/src/helpers/Format.cpp
+++ b/src/helpers/Format.cpp
@@ -1,7 +1,7 @@
#include "Format.hpp"
#include <vector>
#include "../includes.hpp"
-#include "debug/Log.hpp"
+#include "debug/log/Logger.hpp"
#include "../macros.hpp"
#include <xf86drm.h>
#include <drm_fourcc.h>
diff --git a/src/helpers/MiscFunctions.cpp b/src/helpers/MiscFunctions.cpp
index 25b179e9..79504b31 100644
--- a/src/helpers/MiscFunctions.cpp
+++ b/src/helpers/MiscFunctions.cpp
@@ -19,6 +19,7 @@
#include <fcntl.h>
#include <iomanip>
#include <sstream>
+#include <fstream>
#ifdef HAS_EXECINFO
#include <execinfo.h>
#endif
@@ -103,7 +104,7 @@ std::optional<float> getPlusMinusKeywordResult(std::string source, float relativ
try {
return relative + stof(source);
} catch (...) {
- Debug::log(ERR, "Invalid arg \"{}\" in getPlusMinusKeywordResult!", source);
+ Log::logger->log(Log::ERR, "Invalid arg \"{}\" in getPlusMinusKeywordResult!", source);
return {};
}
}
@@ -148,7 +149,7 @@ SWorkspaceIDName getWorkspaceIDNameFromString(const std::string& in) {
const bool same_mon = in.substr(5).contains("m");
const bool next = in.substr(5).contains("n");
if ((same_mon || next) && !Desktop::focusState()->monitor()) {
- Debug::log(ERR, "Empty monitor workspace on monitor null!");
+ Log::logger->log(Log::ERR, "Empty monitor workspace on monitor null!");
return {WORKSPACE_INVALID};
}
@@ -186,14 +187,14 @@ SWorkspaceIDName getWorkspaceIDNameFromString(const std::string& in) {
const auto PLASTWORKSPACE = g_pCompositor->getWorkspaceByID(PREVWORKSPACEIDNAME.id);
if (!PLASTWORKSPACE) {
- Debug::log(LOG, "previous workspace {} doesn't exist yet", PREVWORKSPACEIDNAME.id);
+ Log::logger->log(Log::DEBUG, "previous workspace {} doesn't exist yet", PREVWORKSPACEIDNAME.id);
return {PREVWORKSPACEIDNAME.id, PREVWORKSPACEIDNAME.name};
}
return {PLASTWORKSPACE->m_id, PLASTWORKSPACE->m_name};
} else if (in == "next") {
if (!Desktop::focusState()->monitor() || !Desktop::focusState()->monitor()->m_activeWorkspace) {
- Debug::log(ERR, "no active monitor or workspace for 'next'");
+ Log::logger->log(Log::ERR, "no active monitor or workspace for 'next'");
return {WORKSPACE_INVALID};
}
@@ -211,7 +212,7 @@ SWorkspaceIDName getWorkspaceIDNameFromString(const std::string& in) {
if (in[0] == 'r' && (in[1] == '-' || in[1] == '+' || in[1] == '~') && isNumber(in.substr(2))) {
bool absolute = in[1] == '~';
if (!Desktop::focusState()->monitor()) {
- Debug::log(ERR, "Relative monitor workspace on monitor null!");
+ Log::logger->log(Log::ERR, "Relative monitor workspace on monitor null!");
return {WORKSPACE_INVALID};
}
@@ -373,7 +374,7 @@ SWorkspaceIDName getWorkspaceIDNameFromString(const std::string& in) {
bool absolute = in[1] == '~';
if (!Desktop::focusState()->monitor()) {
- Debug::log(ERR, "Relative monitor workspace on monitor null!");
+ Log::logger->log(Log::ERR, "Relative monitor workspace on monitor null!");
return {WORKSPACE_INVALID};
}
@@ -445,7 +446,7 @@ SWorkspaceIDName getWorkspaceIDNameFromString(const std::string& in) {
result.id = std::max(sc<int>(PLUSMINUSRESULT.value()), 1);
} else {
- Debug::log(ERR, "Relative workspace on no mon!");
+ Log::logger->log(Log::ERR, "Relative workspace on no mon!");
return {WORKSPACE_INVALID};
}
} else if (isNumber(in))
@@ -524,12 +525,12 @@ void logSystemInfo() {
uname(&unameInfo);
- Debug::log(LOG, "System name: {}", std::string{unameInfo.sysname});
- Debug::log(LOG, "Node name: {}", std::string{unameInfo.nodename});
- Debug::log(LOG, "Release: {}", std::string{unameInfo.release});
- Debug::log(LOG, "Version: {}", std::string{unameInfo.version});
+ Log::logger->log(Log::DEBUG, "System name: {}", std::string{unameInfo.sysname});
+ Log::logger->log(Log::DEBUG, "Node name: {}", std::string{unameInfo.nodename});
+ Log::logger->log(Log::DEBUG, "Release: {}", std::string{unameInfo.release});
+ Log::logger->log(Log::DEBUG, "Version: {}", std::string{unameInfo.version});
- Debug::log(NONE, "\n");
+ Log::logger->log(Log::DEBUG, "\n");
#if defined(__DragonFly__) || defined(__FreeBSD__)
const std::string GPUINFO = execAndGet("pciconf -lv | grep -F -A4 vga");
@@ -555,16 +556,16 @@ void logSystemInfo() {
#else
const std::string GPUINFO = execAndGet("lspci -vnn | grep -E '(VGA|Display|3D)'");
#endif
- Debug::log(LOG, "GPU information:\n{}\n", GPUINFO);
+ Log::logger->log(Log::DEBUG, "GPU information:\n{}\n", GPUINFO);
if (GPUINFO.contains("NVIDIA")) {
- Debug::log(WARN, "Warning: you're using an NVIDIA GPU. Make sure you follow the instructions on the wiki if anything is amiss.\n");
+ Log::logger->log(Log::WARN, "Warning: you're using an NVIDIA GPU. Make sure you follow the instructions on the wiki if anything is amiss.\n");
}
// log etc
- Debug::log(LOG, "os-release:");
+ Log::logger->log(Log::DEBUG, "os-release:");
- Debug::log(NONE, "{}", NFsUtils::readFileAsString("/etc/os-release").value_or("error"));
+ Log::logger->log(Log::DEBUG, "{}", NFsUtils::readFileAsString("/etc/os-release").value_or("error"));
}
int64_t getPPIDof(int64_t pid) {
@@ -767,17 +768,10 @@ std::vector<SCallstackFrameInfo> getBacktrace() {
}
void throwError(const std::string& err) {
- Debug::log(CRIT, "Critical error thrown: {}", err);
+ Log::logger->log(Log::CRIT, "Critical error thrown: {}", err);
throw std::runtime_error(err);
}
-bool envEnabled(const std::string& env) {
- const auto ENV = getenv(env.c_str());
- if (!ENV)
- return false;
- return std::string(ENV) == "1";
-}
-
std::pair<CFileDescriptor, std::string> openExclusiveShm() {
// Only absolute paths can be shared across different shm_open() calls
std::string name = "/" + g_pTokenManager->getRandomUUID();
@@ -872,7 +866,7 @@ bool isNvidiaDriverVersionAtLeast(int threshold) {
if (firstDot != std::string::npos)
driverMajor = std::stoi(driverInfo.substr(0, firstDot));
- Debug::log(LOG, "Parsed NVIDIA major version: {}", driverMajor);
+ Log::logger->log(Log::DEBUG, "Parsed NVIDIA major version: {}", driverMajor);
} catch (std::exception& e) {
driverMajor = 0; // Default to 0 if parsing fails
diff --git a/src/helpers/MiscFunctions.hpp b/src/helpers/MiscFunctions.hpp
index 183b6fac..437cfcb4 100644
--- a/src/helpers/MiscFunctions.hpp
+++ b/src/helpers/MiscFunctions.hpp
@@ -36,7 +36,6 @@ std::optional<float> getPlusMinusKeywordResult(std::string in
double normalizeAngleRad(double ang);
std::vector<SCallstackFrameInfo> getBacktrace();
void throwError(const std::string& err);
-bool envEnabled(const std::string& env);
Hyprutils::OS::CFileDescriptor allocateSHMFile(size_t len);
bool allocateSHMFilePair(size_t size, Hyprutils::OS::CFileDescriptor& rw_fd_ptr, Hyprutils::OS::CFileDescriptor& ro_fd_ptr);
float stringToPercentage(const std::string& VALUE, const float REL);
diff --git a/src/helpers/Monitor.cpp b/src/helpers/Monitor.cpp
index fe6f9199..37e11908 100644
--- a/src/helpers/Monitor.cpp
+++ b/src/helpers/Monitor.cpp
@@ -33,7 +33,7 @@
#include "../desktop/view/LayerSurface.hpp"
#include "../desktop/state/FocusState.hpp"
#include <aquamarine/output/Output.hpp>
-#include "debug/Log.hpp"
+#include "debug/log/Logger.hpp"
#include "debug/HyprNotificationOverlay.hpp"
#include "MonitorFrameScheduler.hpp"
#include <hyprutils/string/String.hpp>
@@ -146,14 +146,14 @@ void CMonitor::onConnect(bool noRule) {
});
m_listeners.destroy = m_output->events.destroy.listen([this] {
- Debug::log(LOG, "Destroy called for monitor {}", m_name);
+ Log::logger->log(Log::DEBUG, "Destroy called for monitor {}", m_name);
onDisconnect(true);
m_output = nullptr;
m_renderingInitPassed = false;
- Debug::log(LOG, "Removing monitor {} from realMonitors", m_name);
+ Log::logger->log(Log::DEBUG, "Removing monitor {} from realMonitors", m_name);
std::erase_if(g_pCompositor->m_realMonitors, [&](PHLMONITOR& el) { return el.get() == this; });
});
@@ -165,7 +165,7 @@ void CMonitor::onConnect(bool noRule) {
if (m_createdByUser)
return;
- Debug::log(LOG, "Reapplying monitor rule for {} from a state request", m_name);
+ Log::logger->log(Log::DEBUG, "Reapplying monitor rule for {} from a state request", m_name);
applyMonitorRule(&m_activeMonitorRule, true);
return;
}
@@ -224,7 +224,7 @@ void CMonitor::onConnect(bool noRule) {
m_output->state->setEnabled(false);
if (!m_state.commit())
- Debug::log(ERR, "Couldn't commit disabled state on output {}", m_output->name);
+ Log::logger->log(Log::ERR, "Couldn't commit disabled state on output {}", m_output->name);
m_enabled = false;
@@ -233,7 +233,7 @@ void CMonitor::onConnect(bool noRule) {
}
if (m_output->nonDesktop) {
- Debug::log(LOG, "Not configuring non-desktop output");
+ Log::logger->log(Log::DEBUG, "Not configuring non-desktop output");
for (auto& [name, lease] : PROTO::lease) {
if (!lease || m_output->getBackend() != lease->getBackend())
@@ -270,11 +270,11 @@ void CMonitor::onConnect(bool noRule) {
applyMonitorRule(&monitorRule, true);
if (!m_state.commit())
- Debug::log(WARN, "state.commit() failed in CMonitor::onCommit");
+ Log::logger->log(Log::WARN, "state.commit() failed in CMonitor::onCommit");
m_damage.setSize(m_transformedSize);
- Debug::log(LOG, "Added new monitor with name {} at {:j0} with size {:j0}, pointer {:x}", m_output->name, m_position, m_pixelSize, rc<uintptr_t>(m_output.get()));
+ Log::logger->log(Log::DEBUG, "Added new monitor with name {} at {:j0} with size {:j0}, pointer {:x}", m_output->name, m_position, m_pixelSize, rc<uintptr_t>(m_output.get()));
setupDefaultWS(monitorRule);
@@ -317,18 +317,18 @@ void CMonitor::onConnect(bool noRule) {
}
}
- Debug::log(LOG, "checking if we have seen this monitor before: {}", m_name);
+ Log::logger->log(Log::DEBUG, "checking if we have seen this monitor before: {}", m_name);
// if we saw this monitor before, set it to the workspace it was on
if (g_pCompositor->m_seenMonitorWorkspaceMap.contains(m_name)) {
auto workspaceID = g_pCompositor->m_seenMonitorWorkspaceMap[m_name];
- Debug::log(LOG, "Monitor {} was on workspace {}, setting it to that", m_name, workspaceID);
+ Log::logger->log(Log::DEBUG, "Monitor {} was on workspace {}, setting it to that", m_name, workspaceID);
auto ws = g_pCompositor->getWorkspaceByID(workspaceID);
if (ws) {
g_pCompositor->moveWorkspaceToMonitor(ws, m_self.lock());
changeWorkspace(ws, true, false, false);
}
} else
- Debug::log(LOG, "Monitor {} was not on any workspace", m_name);
+ Log::logger->log(Log::DEBUG, "Monitor {} was not on any workspace", m_name);
if (!found)
Desktop::focusState()->rawMonitorFocus(m_self.lock());
@@ -360,7 +360,7 @@ void CMonitor::onDisconnect(bool destroy) {
if (!m_enabled || g_pCompositor->m_isShuttingDown)
return;
- Debug::log(LOG, "onDisconnect called for {}", m_output->name);
+ Log::logger->log(Log::DEBUG, "onDisconnect called for {}", m_output->name);
m_events.disconnect.emit();
if (g_pHyprOpenGL)
@@ -368,7 +368,7 @@ void CMonitor::onDisconnect(bool destroy) {
// record what workspace this monitor was on
if (m_activeWorkspace) {
- Debug::log(LOG, "Disconnecting Monitor {} was on workspace {}", m_name, m_activeWorkspace->m_id);
+ Log::logger->log(Log::DEBUG, "Disconnecting Monitor {} was on workspace {}", m_name, m_activeWorkspace->m_id);
g_pCompositor->m_seenMonitorWorkspaceMap[m_name] = m_activeWorkspace->m_id;
}
@@ -412,10 +412,10 @@ void CMonitor::onDisconnect(bool destroy) {
}
std::erase_if(g_pCompositor->m_monitors, [&](PHLMONITOR& el) { return el.get() == this; });
- Debug::log(LOG, "Removed monitor {}!", m_name);
+ Log::logger->log(Log::DEBUG, "Removed monitor {}!", m_name);
if (!BACKUPMON) {
- Debug::log(WARN, "Unplugged last monitor, entering an unsafe state. Good luck my friend.");
+ Log::logger->log(Log::WARN, "Unplugged last monitor, entering an unsafe state. Good luck my friend.");
g_pCompositor->enterUnsafeState();
}
@@ -453,7 +453,7 @@ void CMonitor::onDisconnect(bool destroy) {
m_output->state->setEnabled(false);
if (!m_state.commit())
- Debug::log(WARN, "state.commit() failed in CMonitor::onDisconnect");
+ Log::logger->log(Log::WARN, "state.commit() failed in CMonitor::onDisconnect");
if (Desktop::focusState()->monitor() == m_self)
Desktop::focusState()->rawMonitorFocus(BACKUPMON ? BACKUPMON : g_pCompositor->m_unsafeOutput.lock());
@@ -560,7 +560,7 @@ bool CMonitor::applyMonitorRule(SMonitorRule* pMonitorRule, bool force) {
static auto PDISABLESCALECHECKS = CConfigValue<Hyprlang::INT>("debug:disable_scale_checks");
- Debug::log(LOG, "Applying monitor rule for {}", m_name);
+ Log::logger->log(Log::DEBUG, "Applying monitor rule for {}", m_name);
m_activeMonitorRule = *pMonitorRule;
@@ -585,7 +585,7 @@ bool CMonitor::applyMonitorRule(SMonitorRule* pMonitorRule, bool force) {
if (!m_enabled) {
onConnect(true); // enable it.
- Debug::log(LOG, "Monitor {} is disabled but is requested to be enabled", m_name);
+ Log::logger->log(Log::DEBUG, "Monitor {} is disabled but is requested to be enabled", m_name);
force = true;
}
@@ -605,7 +605,7 @@ bool CMonitor::applyMonitorRule(SMonitorRule* pMonitorRule, bool force) {
RULE->supportsWideColor == m_supportsWideColor && RULE->supportsHDR == m_supportsHDR && RULE->minLuminance == m_minLuminance && RULE->maxLuminance == m_maxLuminance &&
RULE->maxAvgLuminance == m_maxAvgLuminance && !std::memcmp(&m_customDrmMode, &RULE->drmMode, sizeof(m_customDrmMode)) && m_reservedArea == RULE->reservedArea) {
- Debug::log(LOG, "Not applying a new rule to {} because it's already applied!", m_name);
+ Log::logger->log(Log::DEBUG, "Not applying a new rule to {} because it's already applied!", m_name);
setMirror(RULE->mirrorOf);
@@ -642,7 +642,7 @@ bool CMonitor::applyMonitorRule(SMonitorRule* pMonitorRule, bool force) {
// last fallback is always preferred mode
if (!m_output->preferredMode())
- Debug::log(ERR, "Monitor {} has NO PREFERRED MODE", m_output->name);
+ Log::logger->log(Log::ERR, "Monitor {} has NO PREFERRED MODE", m_output->name);
else
requestedModes.push_back(m_output->preferredMode());
@@ -717,7 +717,7 @@ bool CMonitor::applyMonitorRule(SMonitorRule* pMonitorRule, bool force) {
// then if requested is custom, try custom mode first
if (RULE->drmMode.type == DRM_MODE_TYPE_USERDEF) {
if (m_output->getBackend()->type() != Aquamarine::eBackendType::AQ_BACKEND_DRM)
- Debug::log(ERR, "Tried to set custom modeline on non-DRM output");
+ Log::logger->log(Log::ERR, "Tried to set custom modeline on non-DRM output");
else
requestedModes.push_back(makeShared<Aquamarine::SOutputMode>(
Aquamarine::SOutputMode{.pixelSize = {RULE->drmMode.hdisplay, RULE->drmMode.vdisplay}, .refreshRate = RULE->drmMode.vrefresh, .modeInfo = RULE->drmMode}));
@@ -737,13 +737,13 @@ bool CMonitor::applyMonitorRule(SMonitorRule* pMonitorRule, bool force) {
m_drmFormat = DRM_FORMAT_XRGB8888;
m_output->state->resetExplicitFences();
- if (Debug::m_trace) {
- Debug::log(TRACE, "Monitor {} requested modes:", m_name);
+ if (Env::isTrace()) {
+ Log::logger->log(Log::TRACE, "Monitor {} requested modes:", m_name);
if (requestedModes.empty())
- Debug::log(TRACE, "| None");
+ Log::logger->log(Log::TRACE, "| None");
else {
for (auto const& mode : requestedModes | std::views::reverse) {
- Debug::log(TRACE, "| {:X0}@{:.2f}Hz", mode->pixelSize, mode->refreshRate / 1000.f);
+ Log::logger->log(Log::TRACE, "| {:X0}@{:.2f}Hz", mode->pixelSize, mode->refreshRate / 1000.f);
}
}
}
@@ -755,7 +755,7 @@ bool CMonitor::applyMonitorRule(SMonitorRule* pMonitorRule, bool force) {
m_output->state->setCustomMode(mode);
if (!m_state.test()) {
- Debug::log(ERR, "Monitor {}: REJECTED custom mode {}!", m_name, modeStr);
+ Log::logger->log(Log::ERR, "Monitor {}: REJECTED custom mode {}!", m_name, modeStr);
continue;
}
@@ -764,9 +764,9 @@ bool CMonitor::applyMonitorRule(SMonitorRule* pMonitorRule, bool force) {
m_output->state->setMode(mode);
if (!m_state.test()) {
- Debug::log(ERR, "Monitor {}: REJECTED available mode {}!", m_name, modeStr);
+ Log::logger->log(Log::ERR, "Monitor {}: REJECTED available mode {}!", m_name, modeStr);
if (mode->preferred)
- Debug::log(ERR, "Monitor {}: REJECTED preferred mode!!!", m_name);
+ Log::logger->log(Log::ERR, "Monitor {}: REJECTED preferred mode!!!", m_name);
continue;
}
@@ -780,11 +780,11 @@ bool CMonitor::applyMonitorRule(SMonitorRule* pMonitorRule, bool force) {
success = true;
if (mode->preferred)
- Debug::log(LOG, "Monitor {}: requested {}, using preferred mode {}", m_name, requestedStr, modeStr);
+ Log::logger->log(Log::DEBUG, "Monitor {}: requested {}, using preferred mode {}", m_name, requestedStr, modeStr);
else if (mode->modeInfo.has_value() && mode->modeInfo->type == DRM_MODE_TYPE_USERDEF)
- Debug::log(LOG, "Monitor {}: requested {}, using custom mode {}", m_name, requestedStr, modeStr);
+ Log::logger->log(Log::DEBUG, "Monitor {}: requested {}, using custom mode {}", m_name, requestedStr, modeStr);
else
- Debug::log(LOG, "Monitor {}: requested {}, using available mode {}", m_name, requestedStr, modeStr);
+ Log::logger->log(Log::DEBUG, "Monitor {}: requested {}, using available mode {}", m_name, requestedStr, modeStr);
break;
}
@@ -798,7 +798,7 @@ bool CMonitor::applyMonitorRule(SMonitorRule* pMonitorRule, bool force) {
m_output->state->setCustomMode(mode);
if (m_state.test()) {
- Debug::log(LOG, "Monitor {}: requested {}, using custom mode {}", m_name, requestedStr, modeStr);
+ Log::logger->log(Log::DEBUG, "Monitor {}: requested {}, using custom mode {}", m_name, requestedStr, modeStr);
refreshRate = mode->refreshRate / 1000.f;
m_size = mode->pixelSize;
@@ -807,7 +807,7 @@ bool CMonitor::applyMonitorRule(SMonitorRule* pMonitorRule, bool force) {
success = true;
} else
- Debug::log(ERR, "Monitor {}: REJECTED custom mode {}!", m_name, modeStr);
+ Log::logger->log(Log::ERR, "Monitor {}: REJECTED custom mode {}!", m_name, modeStr);
}
// try any of the modes if none of the above work
@@ -820,7 +820,7 @@ bool CMonitor::applyMonitorRule(SMonitorRule* pMonitorRule, bool force) {
auto errorMessage = I18n::i18nEngine()->localize(I18n::TXT_KEY_NOTIF_MONITOR_MODE_FAIL,
{{"name", m_name}, {"mode", std::format("{:X0}@{:.2f}Hz", mode->pixelSize, mode->refreshRate / 1000.f)}});
- Debug::log(WARN, errorMessage);
+ Log::logger->log(Log::WARN, errorMessage);
g_pHyprNotificationOverlay->addNotification(errorMessage, CHyprColor(0xff0000ff), 5000, ICON_WARNING);
m_refreshRate = mode->refreshRate / 1000.f;
@@ -835,7 +835,7 @@ bool CMonitor::applyMonitorRule(SMonitorRule* pMonitorRule, bool force) {
}
if (!success) {
- Debug::log(ERR, "Monitor {} has NO FALLBACK MODES, and an INVALID one was requested: {:X0}@{:.2f}Hz", m_name, RULE->resolution, RULE->refreshRate);
+ Log::logger->log(Log::ERR, "Monitor {} has NO FALLBACK MODES, and an INVALID one was requested: {:X0}@{:.2f}Hz", m_name, RULE->resolution, RULE->refreshRate);
return true;
}
@@ -863,9 +863,9 @@ bool CMonitor::applyMonitorRule(SMonitorRule* pMonitorRule, bool force) {
m_drmFormat = fmt.second;
if (!m_state.test()) {
- Debug::log(ERR, "output {} failed basic test on format {}", m_name, fmt.first);
+ Log::logger->log(Log::ERR, "output {} failed basic test on format {}", m_name, fmt.first);
} else {
- Debug::log(LOG, "output {} succeeded basic test on format {}", m_name, fmt.first);
+ Log::logger->log(Log::DEBUG, "output {} succeeded basic test on format {}", m_name, fmt.first);
if (RULE->enable10bit && fmt.first.contains("101010"))
set10bit = true;
break;
@@ -937,13 +937,13 @@ bool CMonitor::applyMonitorRule(SMonitorRule* pMonitorRule, bool force) {
if (autoScale)
m_scale = std::round(scaleZero);
else {
- Debug::log(ERR, "Invalid scale passed to monitor, {} failed to find a clean divisor", m_scale);
+ Log::logger->log(Log::ERR, "Invalid scale passed to monitor, {} failed to find a clean divisor", m_scale);
g_pConfigManager->addParseError("Invalid scale passed to monitor " + m_name + ", failed to find a clean divisor");
m_scale = getDefaultScale();
}
} else {
if (!autoScale) {
- Debug::log(ERR, "Invalid scale passed to monitor, {} found suggestion {}", m_scale, searchScale);
+ Log::logger->log(Log::ERR, "Invalid scale passed to monitor, {} found suggestion {}", m_scale, searchScale);
static auto PDISABLENOTIFICATION = CConfigValue<Hyprlang::INT>("misc:disable_scale_notification");
if (!*PDISABLENOTIFICATION)
g_pHyprNotificationOverlay->addNotification(
@@ -959,7 +959,7 @@ bool CMonitor::applyMonitorRule(SMonitorRule* pMonitorRule, bool force) {
m_output->scheduleFrame();
if (!m_state.commit())
- Debug::log(ERR, "Couldn't commit output named {}", m_output->name);
+ Log::logger->log(Log::ERR, "Couldn't commit output named {}", m_output->name);
Vector2D xfmd = m_transform % 2 == 1 ? Vector2D{m_pixelSize.y, m_pixelSize.x} : m_pixelSize;
m_size = (xfmd / m_scale).round();
@@ -994,8 +994,8 @@ bool CMonitor::applyMonitorRule(SMonitorRule* pMonitorRule, bool force) {
// reload to fix mirrors
g_pConfigManager->m_wantsMonitorReload = true;
- Debug::log(LOG, "Monitor {} data dump: res {:X}@{:.2f}Hz, scale {:.2f}, transform {}, pos {:X}, 10b {}", m_name, m_pixelSize, m_refreshRate, m_scale, sc<int>(m_transform),
- m_position, sc<int>(m_enabled10bit));
+ Log::logger->log(Log::DEBUG, "Monitor {} data dump: res {:X}@{:.2f}Hz, scale {:.2f}, transform {}, pos {:X}, 10b {}", m_name, m_pixelSize, m_refreshRate, m_scale,
+ sc<int>(m_transform), m_position, sc<int>(m_enabled10bit));
EMIT_HOOK_EVENT("monitorLayoutChanged", nullptr);
@@ -1090,12 +1090,12 @@ void CMonitor::setupDefaultWS(const SMonitorRule& monitorRule) {
wsID = std::ranges::distance(g_pCompositor->getWorkspaces()) + 1;
newDefaultWorkspaceName = std::to_string(wsID);
- Debug::log(LOG, "Invalid workspace= directive name in monitor parsing, workspace name \"{}\" is invalid.", g_pConfigManager->getDefaultWorkspaceFor(m_name));
+ Log::logger->log(Log::DEBUG, "Invalid workspace= directive name in monitor parsing, workspace name \"{}\" is invalid.", g_pConfigManager->getDefaultWorkspaceFor(m_name));
}
auto PNEWWORKSPACE = g_pCompositor->getWorkspaceByID(wsID);
- Debug::log(LOG, "New monitor: WORKSPACEID {}, exists: {}", wsID, sc<int>(PNEWWORKSPACE != nullptr));
+ Log::logger->log(Log::DEBUG, "New monitor: WORKSPACEID {}, exists: {}", wsID, sc<int>(PNEWWORKSPACE != nullptr));
if (PNEWWORKSPACE) {
// workspace exists, move it to the newly connected monitor
@@ -1124,12 +1124,12 @@ void CMonitor::setMirror(const std::string& mirrorOf) {
return;
if (PMIRRORMON && PMIRRORMON->isMirror()) {
- Debug::log(ERR, "Cannot mirror a mirror!");
+ Log::logger->log(Log::ERR, "Cannot mirror a mirror!");
return;
}
if (PMIRRORMON == m_self) {
- Debug::log(ERR, "Cannot mirror self!");
+ Log::logger->log(Log::ERR, "Cannot mirror self!");
return;
}
@@ -1257,7 +1257,7 @@ void CMonitor::changeWorkspace(const PHLWORKSPACE& pWorkspace, bool internal, bo
if (pWorkspace->m_isSpecialWorkspace) {
if (m_activeSpecialWorkspace != pWorkspace) {
- Debug::log(LOG, "changeworkspace on special, togglespecialworkspace to id {}", pWorkspace->m_id);
+ Log::logger->log(Log::DEBUG, "changeworkspace on special, togglespecialworkspace to id {}", pWorkspace->m_id);
setSpecialWorkspace(pWorkspace);
}
return;
@@ -1693,7 +1693,7 @@ uint8_t CMonitor::isTearingBlocked(bool full) {
if (!*PTEARINGENABLED) {
reasons |= TC_USER;
if (!full) {
- Debug::log(WARN, "Tearing commit requested but the master switch general:allow_tearing is off, ignoring");
+ Log::logger->log(Log::WARN, "Tearing commit requested but the master switch general:allow_tearing is off, ignoring");
return reasons;
}
}
@@ -1701,7 +1701,7 @@ uint8_t CMonitor::isTearingBlocked(bool full) {
if (g_pHyprOpenGL->m_renderData.mouseZoomFactor != 1.0) {
reasons |= TC_ZOOM;
if (!full) {
- Debug::log(WARN, "Tearing commit requested but scale factor is not 1, ignoring");
+ Log::logger->log(Log::WARN, "Tearing commit requested but scale factor is not 1, ignoring");
return reasons;
}
}
@@ -1709,7 +1709,7 @@ uint8_t CMonitor::isTearingBlocked(bool full) {
if (!m_tearingState.canTear) {
reasons |= TC_SUPPORT;
if (!full) {
- Debug::log(WARN, "Tearing commit requested but monitor doesn't support it, ignoring");
+ Log::logger->log(Log::WARN, "Tearing commit requested but monitor doesn't support it, ignoring");
return reasons;
}
}
@@ -1821,8 +1821,8 @@ bool CMonitor::attemptDirectScanout() {
const auto PSURFACE = PCANDIDATE->getSolitaryResource();
const auto params = PSURFACE->m_current.buffer->dmabuf();
- Debug::log(TRACE, "attemptDirectScanout: surface {:x} passed, will attempt, buffer {} fmt: {} -> {} (mod {})", rc<uintptr_t>(PSURFACE.get()),
- rc<uintptr_t>(PSURFACE->m_current.buffer.m_buffer.get()), m_drmFormat, params.format, params.modifier);
+ Log::logger->log(Log::TRACE, "attemptDirectScanout: surface {:x} passed, will attempt, buffer {} fmt: {} -> {} (mod {})", rc<uintptr_t>(PSURFACE.get()),
+ rc<uintptr_t>(PSURFACE->m_current.buffer.m_buffer.get()), m_drmFormat, params.format, params.modifier);
auto PBUFFER = PSURFACE->m_current.buffer.m_buffer;
@@ -1832,12 +1832,12 @@ bool CMonitor::attemptDirectScanout() {
if (m_scanoutNeedsCursorUpdate) {
if (!m_state.test()) {
- Debug::log(TRACE, "attemptDirectScanout: failed basic test on cursor update");
+ Log::logger->log(Log::TRACE, "attemptDirectScanout: failed basic test on cursor update");
return false;
}
if (!m_output->commit()) {
- Debug::log(TRACE, "attemptDirectScanout: failed to commit cursor update");
+ Log::logger->log(Log::TRACE, "attemptDirectScanout: failed to commit cursor update");
m_lastScanout.reset();
return false;
}
@@ -1865,12 +1865,12 @@ bool CMonitor::attemptDirectScanout() {
}
m_output->state->setBuffer(PBUFFER);
- Debug::log(TRACE, "attemptDirectScanout: setting presentation mode");
+ Log::logger->log(Log::TRACE, "attemptDirectScanout: setting presentation mode");
m_output->state->setPresentationMode(m_tearingState.activelyTearing ? Aquamarine::eOutputPresentationMode::AQ_OUTPUT_PRESENTATION_IMMEDIATE :
Aquamarine::eOutputPresentationMode::AQ_OUTPUT_PRESENTATION_VSYNC);
if (!m_state.test()) {
- Debug::log(TRACE, "attemptDirectScanout: failed basic test");
+ Log::logger->log(Log::TRACE, "attemptDirectScanout: failed basic test");
return false;
}
@@ -1884,14 +1884,14 @@ bool CMonitor::attemptDirectScanout() {
bool ok = m_output->commit();
if (!ok) {
- Debug::log(TRACE, "attemptDirectScanout: failed to scanout surface");
+ Log::logger->log(Log::TRACE, "attemptDirectScanout: failed to scanout surface");
m_lastScanout.reset();
return false;
}
if (m_lastScanout.expired()) {
m_lastScanout = PCANDIDATE;
- Debug::log(LOG, "Entered a direct scanout to {:x}: \"{}\"", rc<uintptr_t>(PCANDIDATE.get()), PCANDIDATE->m_title);
+ Log::logger->log(Log::DEBUG, "Entered a direct scanout to {:x}: \"{}\"", rc<uintptr_t>(PCANDIDATE.get()), PCANDIDATE->m_title);
}
m_scanoutNeedsCursorUpdate = false;
@@ -1947,7 +1947,7 @@ void CMonitor::commitDPMSState(bool state) {
m_output->state->setEnabled(state);
if (!m_state.commit()) {
- Debug::log(ERR, "Couldn't commit output {} for DPMS = {}, will retry.", m_name, state);
+ Log::logger->log(Log::ERR, "Couldn't commit output {} for DPMS = {}, will retry.", m_name, state);
// retry in 2 frames. This could happen when the DRM backend rejects our commit
// because disable + enable were sent almost instantly
@@ -1961,7 +1961,7 @@ void CMonitor::commitDPMSState(bool state) {
m_output->state->resetExplicitFences();
m_output->state->setEnabled(m_dpmsStatus);
if (!m_state.commit()) {
- Debug::log(ERR, "Couldn't retry committing output {} for DPMS = {}", m_name, m_dpmsStatus);
+ Log::logger->log(Log::ERR, "Couldn't retry committing output {} for DPMS = {}", m_name, m_dpmsStatus);
return;
}
@@ -1978,8 +1978,8 @@ void CMonitor::commitDPMSState(bool state) {
}
void CMonitor::debugLastPresentation(const std::string& message) {
- Debug::log(TRACE, "{} (last presentation {} - {} fps)", message, m_lastPresentationTimer.getMillis(),
- m_lastPresentationTimer.getMillis() > 0 ? 1000.0f / m_lastPresentationTimer.getMillis() : 0.0f);
+ Log::logger->log(Log::TRACE, "{} (last presentation {} - {} fps)", message, m_lastPresentationTimer.getMillis(),
+ m_lastPresentationTimer.getMillis() > 0 ? 1000.0f / m_lastPresentationTimer.getMillis() : 0.0f);
}
void CMonitor::onCursorMovedOnMonitor() {
@@ -1991,7 +1991,7 @@ void CMonitor::onCursorMovedOnMonitor() {
// output->state->addDamage(CRegion{});
// output->state->setPresentationMode(Aquamarine::eOutputPresentationMode::AQ_OUTPUT_PRESENTATION_IMMEDIATE);
// if (!output->commit())
- // Debug::log(ERR, "onCursorMovedOnMonitor: tearing and wanted to update cursor, failed.");
+ // Log::logger->log(Log::ERR, "onCursorMovedOnMonitor: tearing and wanted to update cursor, failed.");
// FIXME: try to do the above. We currently can't just render because drm is a fucking bitch
// and throws a "nO pRoP cAn Be ChAnGeD dUrInG AsYnC fLiP" on crtc_x
@@ -2094,7 +2094,7 @@ CMonitorState::CMonitorState(CMonitor* owner) : m_owner(owner) {
void CMonitorState::ensureBufferPresent() {
const auto STATE = m_owner->m_output->state->state();
if (!STATE.enabled) {
- Debug::log(TRACE, "CMonitorState::ensureBufferPresent: Ignoring, monitor is not enabled");
+ Log::logger->log(Log::TRACE, "CMonitorState::ensureBufferPresent: Ignoring, monitor is not enabled");
return;
}
@@ -2105,7 +2105,7 @@ void CMonitorState::ensureBufferPresent() {
// this is required for modesetting being possible and might be missing in case of first tests in the renderer
// where we test modes and buffers
- Debug::log(LOG, "CMonitorState::ensureBufferPresent: no buffer or mismatched format, attaching one from the swapchain for modeset being possible");
+ Log::logger->log(Log::DEBUG, "CMonitorState::ensureBufferPresent: no buffer or mismatched format, attaching one from the swapchain for modeset being possible");
m_owner->m_output->state->setBuffer(m_owner->m_output->swapchain->next(nullptr));
m_owner->m_output->swapchain->rollback(); // restore the counter, don't advance the swapchain
}
@@ -2136,7 +2136,7 @@ bool CMonitorState::updateSwapchain() {
const auto& STATE = m_owner->m_output->state->state();
const auto& MODE = STATE.mode ? STATE.mode : STATE.customMode;
if (!MODE) {
- Debug::log(WARN, "updateSwapchain: No mode?");
+ Log::logger->log(Log::WARN, "updateSwapchain: No mode?");
return true;
}
options.format = m_owner->m_drmFormat;
diff --git a/src/helpers/MonitorFrameScheduler.cpp b/src/helpers/MonitorFrameScheduler.cpp
index 1e8a81e5..804eec1e 100644
--- a/src/helpers/MonitorFrameScheduler.cpp
+++ b/src/helpers/MonitorFrameScheduler.cpp
@@ -24,12 +24,12 @@ void CMonitorFrameScheduler::onSyncFired() {
if (std::chrono::duration_cast<std::chrono::microseconds>(hrc::now() - m_lastRenderBegun).count() / 1000.F < 1000.F / m_monitor->m_refreshRate) {
// we are in. Frame is valid. We can just render as normal.
- Debug::log(TRACE, "CMonitorFrameScheduler: {} -> onSyncFired, didn't miss.", m_monitor->m_name);
+ Log::logger->log(Log::TRACE, "CMonitorFrameScheduler: {} -> onSyncFired, didn't miss.", m_monitor->m_name);
m_renderAtFrame = true;
return;
}
- Debug::log(TRACE, "CMonitorFrameScheduler: {} -> onSyncFired, missed.", m_monitor->m_name);
+ Log::logger->log(Log::TRACE, "CMonitorFrameScheduler: {} -> onSyncFired, missed.", m_monitor->m_name);
// we are out. The frame is taking too long to render. Begin rendering immediately, but don't commit yet.
m_pendingThird = true;
@@ -56,11 +56,11 @@ void CMonitorFrameScheduler::onPresented() {
if (!m_pendingThird)
return;
- Debug::log(TRACE, "CMonitorFrameScheduler: {} -> onPresented, missed, committing pending.", m_monitor->m_name);
+ Log::logger->log(Log::TRACE, "CMonitorFrameScheduler: {} -> onPresented, missed, committing pending.", m_monitor->m_name);
m_pendingThird = false;
- Debug::log(TRACE, "CMonitorFrameScheduler: {} -> onPresented, missed, committing pending at the earliest convenience.", m_monitor->m_name);
+ Log::logger->log(Log::TRACE, "CMonitorFrameScheduler: {} -> onPresented, missed, committing pending at the earliest convenience.", m_monitor->m_name);
m_pendingThird = false;
@@ -101,11 +101,11 @@ void CMonitorFrameScheduler::onFrame() {
}
if (!m_renderAtFrame) {
- Debug::log(TRACE, "CMonitorFrameScheduler: {} -> frame event, but m_renderAtFrame = false.", m_monitor->m_name);
+ Log::logger->log(Log::TRACE, "CMonitorFrameScheduler: {} -> frame event, but m_renderAtFrame = false.", m_monitor->m_name);
return;
}
- Debug::log(TRACE, "CMonitorFrameScheduler: {} -> frame event, render = true, rendering normally.", m_monitor->m_name);
+ Log::logger->log(Log::TRACE, "CMonitorFrameScheduler: {} -> frame event, render = true, rendering normally.", m_monitor->m_name);
m_lastRenderBegun = hrc::now();
@@ -132,7 +132,7 @@ void CMonitorFrameScheduler::onFinishRender() {
bool CMonitorFrameScheduler::canRender() {
if ((g_pCompositor->m_aqBackend->hasSession() && !g_pCompositor->m_aqBackend->session->active) || !g_pCompositor->m_sessionActive || g_pCompositor->m_unsafeState) {
- Debug::log(WARN, "Attempted to render frame on inactive session!");
+ Log::logger->log(Log::WARN, "Attempted to render frame on inactive session!");
if (g_pCompositor->m_unsafeState && std::ranges::any_of(g_pCompositor->m_monitors.begin(), g_pCompositor->m_monitors.end(), [&](auto& m) {
return m->m_output != g_pCompositor->m_unsafeOutput->m_output;
diff --git a/src/helpers/env/Env.cpp b/src/helpers/env/Env.cpp
new file mode 100644
index 00000000..606d5f72
--- /dev/null
+++ b/src/helpers/env/Env.cpp
@@ -0,0 +1,19 @@
+#include "Env.hpp"
+
+#include <cstdlib>
+#include <string_view>
+
+bool Env::envEnabled(const std::string& env) {
+ auto ret = getenv(env.c_str());
+ if (!ret)
+ return false;
+
+ const std::string_view sv = ret;
+
+ return !sv.empty() && sv != "0";
+}
+
+bool Env::isTrace() {
+ static bool TRACE = envEnabled("HYPRLAND_TRACE");
+ return TRACE;
+}
diff --git a/src/helpers/env/Env.hpp b/src/helpers/env/Env.hpp
new file mode 100644
index 00000000..030fe736
--- /dev/null
+++ b/src/helpers/env/Env.hpp
@@ -0,0 +1,8 @@
+#pragma once
+
+#include <string>
+
+namespace Env {
+ bool envEnabled(const std::string& env);
+ bool isTrace();
+}
diff --git a/src/helpers/fs/FsUtils.cpp b/src/helpers/fs/FsUtils.cpp
index 0bc2e685..60af7d44 100644
--- a/src/helpers/fs/FsUtils.cpp
+++ b/src/helpers/fs/FsUtils.cpp
@@ -1,8 +1,9 @@
#include "FsUtils.hpp"
-#include "../../debug/Log.hpp"
+#include "../../debug/log/Logger.hpp"
#include <cstdlib>
#include <filesystem>
+#include <fstream>
#include <hyprutils/string/String.hpp>
#include <hyprutils/string/VarList.hpp>
@@ -17,7 +18,7 @@ std::optional<std::string> NFsUtils::getDataHome() {
const auto HOME = getenv("HOME");
if (!HOME) {
- Debug::log(ERR, "FsUtils::getDataHome: can't get data home: no $HOME or $XDG_DATA_HOME");
+ Log::logger->log(Log::ERR, "FsUtils::getDataHome: can't get data home: no $HOME or $XDG_DATA_HOME");
return std::nullopt;
}
@@ -27,26 +28,26 @@ std::optional<std::string> NFsUtils::getDataHome() {
std::error_code ec;
if (!std::filesystem::exists(dataRoot, ec) || ec) {
- Debug::log(ERR, "FsUtils::getDataHome: can't get data home: inaccessible / missing");
+ Log::logger->log(Log::ERR, "FsUtils::getDataHome: can't get data home: inaccessible / missing");
return std::nullopt;
}
dataRoot += "hyprland/";
if (!std::filesystem::exists(dataRoot, ec) || ec) {
- Debug::log(LOG, "FsUtils::getDataHome: no hyprland data home, creating.");
+ Log::logger->log(Log::DEBUG, "FsUtils::getDataHome: no hyprland data home, creating.");
std::filesystem::create_directory(dataRoot, ec);
if (ec) {
- Debug::log(ERR, "FsUtils::getDataHome: can't create new data home for hyprland");
+ Log::logger->log(Log::ERR, "FsUtils::getDataHome: can't create new data home for hyprland");
return std::nullopt;
}
std::filesystem::permissions(dataRoot, std::filesystem::perms::owner_read | std::filesystem::perms::owner_write | std::filesystem::perms::owner_exec, ec);
if (ec)
- Debug::log(WARN, "FsUtils::getDataHome: couldn't set perms on hyprland data store. Proceeding anyways.");
+ Log::logger->log(Log::WARN, "FsUtils::getDataHome: couldn't set perms on hyprland data store. Proceeding anyways.");
}
if (!std::filesystem::exists(dataRoot, ec) || ec) {
- Debug::log(ERR, "FsUtils::getDataHome: no hyprland data home, failed to create.");
+ Log::logger->log(Log::ERR, "FsUtils::getDataHome: no hyprland data home, failed to create.");
return std::nullopt;
}
@@ -69,7 +70,7 @@ std::optional<std::string> NFsUtils::readFileAsString(const std::string& path) {
bool NFsUtils::writeToFile(const std::string& path, const std::string& content) {
std::ofstream of(path, std::ios::trunc);
if (!of.good()) {
- Debug::log(ERR, "CVersionKeeperManager: couldn't open an ofstream for writing the version file.");
+ Log::logger->log(Log::ERR, "CVersionKeeperManager: couldn't open an ofstream for writing the version file.");
return false;
}
diff --git a/src/helpers/math/Expression.cpp b/src/helpers/math/Expression.cpp
index fb28628d..3c0bee91 100644
--- a/src/helpers/math/Expression.cpp
+++ b/src/helpers/math/Expression.cpp
@@ -1,6 +1,6 @@
#include "Expression.hpp"
#include "muParser.h"
-#include "../../debug/Log.hpp"
+#include "../../debug/log/Logger.hpp"
using namespace Math;
@@ -16,7 +16,7 @@ std::optional<double> CExpression::compute(const std::string& expr) {
try {
m_parser->SetExpr(expr);
return m_parser->Eval();
- } catch (mu::Parser::exception_type& e) { Debug::log(ERR, "CExpression::compute: mu threw: {}", e.GetMsg()); }
+ } catch (mu::Parser::exception_type& e) { Log::logger->log(Log::ERR, "CExpression::compute: mu threw: {}", e.GetMsg()); }
return std::nullopt;
}
diff --git a/src/helpers/sync/SyncReleaser.cpp b/src/helpers/sync/SyncReleaser.cpp
index 66d7667f..fbc585d0 100644
--- a/src/helpers/sync/SyncReleaser.cpp
+++ b/src/helpers/sync/SyncReleaser.cpp
@@ -25,7 +25,7 @@ CSyncReleaser::CSyncReleaser(SP<CSyncTimeline> timeline, uint64_t point) : m_tim
CSyncReleaser::~CSyncReleaser() {
if (!m_timeline) {
- Debug::log(ERR, "CSyncReleaser destructing without a timeline");
+ Log::logger->log(Log::ERR, "CSyncReleaser destructing without a timeline");
return;
}
diff --git a/src/helpers/sync/SyncTimeline.cpp b/src/helpers/sync/SyncTimeline.cpp
index 9fe2e406..5a233e48 100644
--- a/src/helpers/sync/SyncTimeline.cpp
+++ b/src/helpers/sync/SyncTimeline.cpp
@@ -16,7 +16,7 @@ SP<CSyncTimeline> CSyncTimeline::create(int drmFD_) {
timeline->m_self = timeline;
if (drmSyncobjCreate(drmFD_, 0, &timeline->m_handle)) {
- Debug::log(ERR, "CSyncTimeline: failed to create a drm syncobj??");
+ Log::logger->log(Log::ERR, "CSyncTimeline: failed to create a drm syncobj??");
return nullptr;
}
@@ -33,7 +33,7 @@ SP<CSyncTimeline> CSyncTimeline::create(int drmFD_, CFileDescriptor&& drmSyncobj
timeline->m_self = timeline;
if (drmSyncobjFDToHandle(drmFD_, timeline->m_syncobjFD.get(), &timeline->m_handle)) {
- Debug::log(ERR, "CSyncTimeline: failed to create a drm syncobj from fd??");
+ Log::logger->log(Log::ERR, "CSyncTimeline: failed to create a drm syncobj from fd??");
return nullptr;
}
@@ -57,7 +57,7 @@ std::optional<bool> CSyncTimeline::check(uint64_t point, uint32_t flags) {
uint32_t signaled = 0;
int ret = drmSyncobjTimelineWait(m_drmFD, &m_handle, &point, 1, 0, flags, &signaled);
if (ret != 0 && ret != -ETIME_ERR) {
- Debug::log(ERR, "CSyncTimeline::check: drmSyncobjTimelineWait failed");
+ Log::logger->log(Log::ERR, "CSyncTimeline::check: drmSyncobjTimelineWait failed");
return std::nullopt;
}
@@ -68,12 +68,12 @@ bool CSyncTimeline::addWaiter(std::function<void()>&& waiter, uint64_t point, ui
auto eventFd = CFileDescriptor(eventfd(0, EFD_CLOEXEC));
if (!eventFd.isValid()) {
- Debug::log(ERR, "CSyncTimeline::addWaiter: failed to acquire an eventfd");
+ Log::logger->log(Log::ERR, "CSyncTimeline::addWaiter: failed to acquire an eventfd");
return false;
}
if (drmSyncobjEventfd(m_drmFD, m_handle, point, eventFd.get(), flags)) {
- Debug::log(ERR, "CSyncTimeline::addWaiter: drmSyncobjEventfd failed");
+ Log::logger->log(Log::ERR, "CSyncTimeline::addWaiter: drmSyncobjEventfd failed");
return false;
}
@@ -87,18 +87,18 @@ CFileDescriptor CSyncTimeline::exportAsSyncFileFD(uint64_t src) {
uint32_t syncHandle = 0;
if (drmSyncobjCreate(m_drmFD, 0, &syncHandle)) {
- Debug::log(ERR, "exportAsSyncFileFD: drmSyncobjCreate failed");
+ Log::logger->log(Log::ERR, "exportAsSyncFileFD: drmSyncobjCreate failed");
return {};
}
if (drmSyncobjTransfer(m_drmFD, syncHandle, 0, m_handle, src, 0)) {
- Debug::log(ERR, "exportAsSyncFileFD: drmSyncobjTransfer failed");
+ Log::logger->log(Log::ERR, "exportAsSyncFileFD: drmSyncobjTransfer failed");
drmSyncobjDestroy(m_drmFD, syncHandle);
return {};
}
if (drmSyncobjExportSyncFile(m_drmFD, syncHandle, &sync)) {
- Debug::log(ERR, "exportAsSyncFileFD: drmSyncobjExportSyncFile failed");
+ Log::logger->log(Log::ERR, "exportAsSyncFileFD: drmSyncobjExportSyncFile failed");
drmSyncobjDestroy(m_drmFD, syncHandle);
return {};
}
@@ -111,18 +111,18 @@ bool CSyncTimeline::importFromSyncFileFD(uint64_t dst, CFileDescriptor& fd) {
uint32_t syncHandle = 0;
if (drmSyncobjCreate(m_drmFD, 0, &syncHandle)) {
- Debug::log(ERR, "importFromSyncFileFD: drmSyncobjCreate failed");
+ Log::logger->log(Log::ERR, "importFromSyncFileFD: drmSyncobjCreate failed");
return false;
}
if (drmSyncobjImportSyncFile(m_drmFD, syncHandle, fd.get())) {
- Debug::log(ERR, "importFromSyncFileFD: drmSyncobjImportSyncFile failed");
+ Log::logger->log(Log::ERR, "importFromSyncFileFD: drmSyncobjImportSyncFile failed");
drmSyncobjDestroy(m_drmFD, syncHandle);
return false;
}
if (drmSyncobjTransfer(m_drmFD, m_handle, dst, syncHandle, 0, 0)) {
- Debug::log(ERR, "importFromSyncFileFD: drmSyncobjTransfer failed");
+ Log::logger->log(Log::ERR, "importFromSyncFileFD: drmSyncobjTransfer failed");
drmSyncobjDestroy(m_drmFD, syncHandle);
return false;
}
@@ -133,12 +133,12 @@ bool CSyncTimeline::importFromSyncFileFD(uint64_t dst, CFileDescriptor& fd) {
bool CSyncTimeline::transfer(SP<CSyncTimeline> from, uint64_t fromPoint, uint64_t toPoint) {
if (m_drmFD != from->m_drmFD) {
- Debug::log(ERR, "CSyncTimeline::transfer: cannot transfer timelines between gpus, {} -> {}", from->m_drmFD, m_drmFD);
+ Log::logger->log(Log::ERR, "CSyncTimeline::transfer: cannot transfer timelines between gpus, {} -> {}", from->m_drmFD, m_drmFD);
return false;
}
if (drmSyncobjTransfer(m_drmFD, m_handle, toPoint, from->m_handle, fromPoint, 0)) {
- Debug::log(ERR, "CSyncTimeline::transfer: drmSyncobjTransfer failed");
+ Log::logger->log(Log::ERR, "CSyncTimeline::transfer: drmSyncobjTransfer failed");
return false;
}
@@ -147,5 +147,5 @@ bool CSyncTimeline::transfer(SP<CSyncTimeline> from, uint64_t fromPoint, uint64_
void CSyncTimeline::signal(uint64_t point) {
if (drmSyncobjTimelineSignal(m_drmFD, &m_handle, &point, 1))
- Debug::log(ERR, "CSyncTimeline::signal: drmSyncobjTimelineSignal failed");
+ Log::logger->log(Log::ERR, "CSyncTimeline::signal: drmSyncobjTimelineSignal failed");
}
diff --git a/src/init/initHelpers.cpp b/src/init/initHelpers.cpp
index c27f625c..f3911c04 100644
--- a/src/init/initHelpers.cpp
+++ b/src/init/initHelpers.cpp
@@ -10,20 +10,20 @@ void NInit::gainRealTime() {
struct sched_param param;
if (pthread_getschedparam(pthread_self(), &old_policy, &param)) {
- Debug::log(WARN, "Failed to get old pthread scheduling priority");
+ Log::logger->log(Log::WARN, "Failed to get old pthread scheduling priority");
return;
}
param.sched_priority = minPrio;
if (pthread_setschedparam(pthread_self(), SCHED_RR, &param)) {
- Debug::log(WARN, "Failed to change process scheduling strategy");
+ Log::logger->log(Log::WARN, "Failed to change process scheduling strategy");
return;
}
pthread_atfork(nullptr, nullptr, []() {
const struct sched_param param = {.sched_priority = 0};
if (pthread_setschedparam(pthread_self(), SCHED_OTHER, &param))
- Debug::log(WARN, "Failed to reset process scheduling strategy");
+ Log::logger->log(Log::WARN, "Failed to reset process scheduling strategy");
});
} \ No newline at end of file
diff --git a/src/layout/DwindleLayout.cpp b/src/layout/DwindleLayout.cpp
index c78b6f28..70e2d6a0 100644
--- a/src/layout/DwindleLayout.cpp
+++ b/src/layout/DwindleLayout.cpp
@@ -118,7 +118,7 @@ void CHyprDwindleLayout::applyNodeDataToWindow(SP<SDwindleNodeData> pNode, bool
PMONITOR = WS->m_monitor.lock();
if (!PMONITOR || !WS) {
- Debug::log(ERR, "Orphaned Node {}!!", pNode);
+ Log::logger->log(Log::ERR, "Orphaned Node {}!!", pNode);
return;
}
@@ -135,7 +135,7 @@ void CHyprDwindleLayout::applyNodeDataToWindow(SP<SDwindleNodeData> pNode, bool
const auto WORKSPACERULE = g_pConfigManager->getWorkspaceRuleFor(g_pCompositor->getWorkspaceByID(pNode->workspaceID));
if (!validMapped(PWINDOW)) {
- Debug::log(ERR, "Node {} holding invalid {}!!", pNode, PWINDOW);
+ Log::logger->log(Log::ERR, "Node {} holding invalid {}!!", pNode, PWINDOW);
onWindowRemovedTiling(PWINDOW);
return;
}
@@ -316,7 +316,7 @@ void CHyprDwindleLayout::onWindowCreatedTiling(PHLWINDOW pWindow, eDirection dir
} else
OPENINGON = getFirstNodeOnWorkspace(pWindow->workspaceID());
- Debug::log(LOG, "OPENINGON: {}, Monitor: {}", OPENINGON, PMONITOR->m_id);
+ Log::logger->log(Log::DEBUG, "OPENINGON: {}, Monitor: {}", OPENINGON, PMONITOR->m_id);
if (OPENINGON && OPENINGON->workspaceID != PNODE->workspaceID) {
// special workspace handling
@@ -489,7 +489,7 @@ void CHyprDwindleLayout::onWindowRemovedTiling(PHLWINDOW pWindow) {
const auto PNODE = getNodeFromWindow(pWindow);
if (!PNODE) {
- Debug::log(ERR, "onWindowRemovedTiling node null?");
+ Log::logger->log(Log::ERR, "onWindowRemovedTiling node null?");
return;
}
@@ -502,7 +502,7 @@ void CHyprDwindleLayout::onWindowRemovedTiling(PHLWINDOW pWindow) {
const auto PPARENT = PNODE->pParent;
if (!PPARENT) {
- Debug::log(LOG, "Removing last node (dwindle)");
+ Log::logger->log(Log::DEBUG, "Removing last node (dwindle)");
std::erase(m_dwindleNodesData, PNODE);
return;
}
@@ -1015,7 +1015,7 @@ std::any CHyprDwindleLayout::layoutMessage(SLayoutMessageHeader header, std::str
std::string direction = ARGS[1];
if (direction.empty()) {
- Debug::log(ERR, "Expected direction for preselect");
+ Log::logger->log(Log::ERR, "Expected direction for preselect");
return "";
}
diff --git a/src/layout/IHyprLayout.cpp b/src/layout/IHyprLayout.cpp
index 73f9d853..8a33928b 100644
--- a/src/layout/IHyprLayout.cpp
+++ b/src/layout/IHyprLayout.cpp
@@ -24,7 +24,7 @@ void IHyprLayout::onWindowCreated(PHLWINDOW pWindow, eDirection direction) {
const auto STOREDSIZE = HASPERSISTENTSIZE ? g_pConfigManager->getStoredFloatingSize(pWindow) : std::nullopt;
if (STOREDSIZE.has_value()) {
- Debug::log(LOG, "using stored size {}x{} for new window {}::{}", STOREDSIZE->x, STOREDSIZE->y, pWindow->m_class, pWindow->m_title);
+ Log::logger->log(Log::DEBUG, "using stored size {}x{} for new window {}::{}", STOREDSIZE->x, STOREDSIZE->y, pWindow->m_class, pWindow->m_title);
pWindow->m_lastFloatingSize = STOREDSIZE.value();
} else if (desiredGeometry.width <= 5 || desiredGeometry.height <= 5) {
const auto PMONITOR = pWindow->m_monitor.lock();
@@ -117,7 +117,7 @@ void IHyprLayout::onWindowCreatedFloating(PHLWINDOW pWindow) {
static auto PXWLFORCESCALEZERO = CConfigValue<Hyprlang::INT>("xwayland:force_zero_scaling");
if (!PMONITOR) {
- Debug::log(ERR, "{:m} has an invalid monitor in onWindowCreatedFloating!!!", pWindow);
+ Log::logger->log(Log::ERR, "{:m} has an invalid monitor in onWindowCreatedFloating!!!", pWindow);
return;
}
@@ -248,7 +248,7 @@ void IHyprLayout::onBeginDragWindow() {
// Window will be floating. Let's check if it's valid. It should be, but I don't like crashing.
if (!validMapped(DRAGGINGWINDOW)) {
- Debug::log(ERR, "Dragging attempted on an invalid window!");
+ Log::logger->log(Log::ERR, "Dragging attempted on an invalid window!");
CKeybindManager::changeMouseBindMode(MBIND_INVALID);
return;
}
@@ -745,7 +745,7 @@ void IHyprLayout::onMouseMove(const Vector2D& mousePos) {
void IHyprLayout::changeWindowFloatingMode(PHLWINDOW pWindow) {
if (pWindow->isFullscreen()) {
- Debug::log(LOG, "changeWindowFloatingMode: fullscreen");
+ Log::logger->log(Log::DEBUG, "changeWindowFloatingMode: fullscreen");
g_pCompositor->setWindowFullscreenInternal(pWindow, FSMODE_NONE);
}
@@ -864,7 +864,7 @@ void IHyprLayout::moveActiveWindow(const Vector2D& delta, PHLWINDOW pWindow) {
return;
if (!PWINDOW->m_isFloating) {
- Debug::log(LOG, "Dwindle cannot move a tiled window in moveActiveWindow!");
+ Log::logger->log(Log::DEBUG, "Dwindle cannot move a tiled window in moveActiveWindow!");
return;
}
@@ -970,7 +970,7 @@ Vector2D IHyprLayout::predictSizeForNewWindowFloating(PHLWINDOW pWindow) { // ge
const auto STOREDSIZE = HASPERSISTENTSIZE ? g_pConfigManager->getStoredFloatingSize(pWindow) : std::nullopt;
if (STOREDSIZE.has_value()) {
- Debug::log(LOG, "using stored size {}x{} for new floating window {}::{}", STOREDSIZE->x, STOREDSIZE->y, pWindow->m_class, pWindow->m_title);
+ Log::logger->log(Log::DEBUG, "using stored size {}x{} for new floating window {}::{}", STOREDSIZE->x, STOREDSIZE->y, pWindow->m_class, pWindow->m_title);
return STOREDSIZE.value();
}
@@ -1008,14 +1008,14 @@ bool IHyprLayout::updateDragWindow() {
if (g_pInputManager->m_dragThresholdReached) {
if (WAS_FULLSCREEN) {
- Debug::log(LOG, "Dragging a fullscreen window");
+ Log::logger->log(Log::DEBUG, "Dragging a fullscreen window");
g_pCompositor->setWindowFullscreenInternal(DRAGGINGWINDOW, FSMODE_NONE);
}
const auto PWORKSPACE = DRAGGINGWINDOW->m_workspace;
if (PWORKSPACE->m_hasFullscreenWindow && (!DRAGGINGWINDOW->m_isFloating || (!DRAGGINGWINDOW->m_createdOverFullscreen && !DRAGGINGWINDOW->m_pinned))) {
- Debug::log(LOG, "Rejecting drag on a fullscreen workspace. (window under fullscreen)");
+ Log::logger->log(Log::DEBUG, "Rejecting drag on a fullscreen workspace. (window under fullscreen)");
g_pKeybindManager->changeMouseBindMode(MBIND_INVALID);
return true;
}
diff --git a/src/layout/MasterLayout.cpp b/src/layout/MasterLayout.cpp
index 2c0dac7f..1546fad5 100644
--- a/src/layout/MasterLayout.cpp
+++ b/src/layout/MasterLayout.cpp
@@ -649,7 +649,7 @@ void CHyprMasterLayout::applyNodeDataToWindow(SMasterNodeData* pNode) {
PMONITOR = WS->m_monitor.lock();
if (!PMONITOR || !WS) {
- Debug::log(ERR, "Orphaned Node {}!!", pNode);
+ Log::logger->log(Log::ERR, "Orphaned Node {}!!", pNode);
return;
}
@@ -678,7 +678,7 @@ void CHyprMasterLayout::applyNodeDataToWindow(SMasterNodeData* pNode) {
auto gapsIn = WORKSPACERULE.gapsIn.value_or(*PGAPSIN);
if (!validMapped(PWINDOW)) {
- Debug::log(ERR, "Node {} holding invalid {}!!", pNode, PWINDOW);
+ Log::logger->log(Log::ERR, "Node {} holding invalid {}!!", pNode, PWINDOW);
return;
}
@@ -1092,7 +1092,7 @@ std::any CHyprMasterLayout::layoutMessage(SLayoutMessageHeader header, std::stri
CVarList vars(message, 0, ' ');
if (vars.size() < 1 || vars[0].empty()) {
- Debug::log(ERR, "layoutmsg called without params");
+ Log::logger->log(Log::ERR, "layoutmsg called without params");
return 0;
}
diff --git a/src/macros.hpp b/src/macros.hpp
index 8a37d6dd..1b55bacd 100644
--- a/src/macros.hpp
+++ b/src/macros.hpp
@@ -6,7 +6,7 @@
#include <utility>
#include "helpers/memory/Memory.hpp"
-#include "debug/Log.hpp"
+#include "debug/log/Logger.hpp"
#ifndef NDEBUG
#ifdef HYPRLAND_DEBUG
@@ -45,9 +45,9 @@
#define RASSERT(expr, reason, ...) \
if (!(expr)) { \
- Debug::log(CRIT, "\n==========================================================================================\nASSERTION FAILED! \n\n{}\n\nat: line {} in {}", \
- std::format(reason, ##__VA_ARGS__), __LINE__, \
- ([]() constexpr -> std::string { return std::string(__FILE__).substr(std::string(__FILE__).find_last_of('/') + 1); })()); \
+ Log::logger->log(Log::CRIT, "\n==========================================================================================\nASSERTION FAILED! \n\n{}\n\nat: line {} in {}", \
+ std::format(reason, ##__VA_ARGS__), __LINE__, \
+ ([]() constexpr -> std::string { return std::string(__FILE__).substr(std::string(__FILE__).find_last_of('/') + 1); })()); \
std::print("Assertion failed! See the log in /tmp/hypr/hyprland.log for more info."); \
raise(SIGABRT); \
}
@@ -83,7 +83,7 @@
#if ISDEBUG
#define UNREACHABLE() \
{ \
- Debug::log(CRIT, "\n\nMEMORY CORRUPTED: Unreachable failed! (Reached an unreachable position, memory corruption!!!)"); \
+ Log::logger->log(Log::CRIT, "\n\nMEMORY CORRUPTED: Unreachable failed! (Reached an unreachable position, memory corruption!!!)"); \
raise(SIGABRT); \
std::unreachable(); \
}
@@ -98,8 +98,8 @@
__CALL__; \
auto err = glGetError(); \
if (err != GL_NO_ERROR) { \
- Debug::log(ERR, "[GLES] Error in call at {}@{}: 0x{:x}", __LINE__, \
- ([]() constexpr -> std::string { return std::string(__FILE__).substr(std::string(__FILE__).find_last_of('/') + 1); })(), err); \
+ Log::logger->log(Log::ERR, "[GLES] Error in call at {}@{}: 0x{:x}", __LINE__, \
+ ([]() constexpr -> std::string { return std::string(__FILE__).substr(std::string(__FILE__).find_last_of('/') + 1); })(), err); \
} \
}
diff --git a/src/main.cpp b/src/main.cpp
index 49d44a09..a499bd48 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -1,9 +1,10 @@
#include "defines.hpp"
-#include "debug/Log.hpp"
+#include "debug/log/Logger.hpp"
#include "Compositor.hpp"
#include "config/ConfigManager.hpp"
#include "init/initHelpers.hpp"
#include "debug/HyprCtl.hpp"
+#include "helpers/env/Env.hpp"
#include <csignal>
#include <cstdio>
@@ -132,7 +133,7 @@ int main(int argc, char** argv) {
return 1;
}
- Debug::log(LOG, "User-specified config location: '{}'", configPath);
+ Log::logger->log(Log::DEBUG, "User-specified config location: '{}'", configPath);
it++;
@@ -219,17 +220,17 @@ int main(int argc, char** argv) {
g_pCompositor->m_safeMode = true;
if (!watchdogOk)
- Debug::log(WARN, "WARNING: Hyprland is being launched without start-hyprland. This is highly advised against.");
+ Log::logger->log(Log::WARN, "WARNING: Hyprland is being launched without start-hyprland. This is highly advised against.");
g_pCompositor->initServer(socketName, socketFd);
if (verifyConfig)
return !g_pConfigManager->m_lastConfigVerificationWasSuccessful;
- if (!envEnabled("HYPRLAND_NO_RT"))
+ if (!Env::envEnabled("HYPRLAND_NO_RT"))
NInit::gainRealTime();
- Debug::log(LOG, "Hyprland init finished.");
+ Log::logger->log(Log::DEBUG, "Hyprland init finished.");
// If all's good to go, start.
g_pCompositor->startCompositor();
@@ -238,7 +239,7 @@ int main(int argc, char** argv) {
g_pCompositor.reset();
- Debug::log(LOG, "Hyprland has reached the end.");
+ Log::logger->log(Log::DEBUG, "Hyprland has reached the end.");
return EXIT_SUCCESS;
}
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;
diff --git a/src/plugins/HookSystem.cpp b/src/plugins/HookSystem.cpp
index 031b1def..f17a4556 100644
--- a/src/plugins/HookSystem.cpp
+++ b/src/plugins/HookSystem.cpp
@@ -1,5 +1,5 @@
#include "HookSystem.hpp"
-#include "../debug/Log.hpp"
+#include "../debug/log/Logger.hpp"
#include "../helpers/varlist/VarList.hpp"
#include "../managers/TokenManager.hpp"
#include "../helpers/MiscFunctions.hpp"
@@ -146,7 +146,7 @@ bool CFunctionHook::hook() {
if (g_pFunctionHookSystem->m_activeHooks.contains(rc<uint64_t>(m_source))) {
// TODO: return actual error codes...
- Debug::log(ERR, "[functionhook] failed, function is already hooked");
+ Log::logger->log(Log::ERR, "[functionhook] failed, function is already hooked");
return false;
}
@@ -174,12 +174,12 @@ bool CFunctionHook::hook() {
const auto PROBEFIXEDASM = fixInstructionProbeRIPCalls(probe);
if (PROBEFIXEDASM.bytes.empty()) {
- Debug::log(ERR, "[functionhook] failed, unsupported asm / failed assembling:\n{}", probe.assembly);
+ Log::logger->log(Log::ERR, "[functionhook] failed, unsupported asm / failed assembling:\n{}", probe.assembly);
return false;
}
if (std::abs(rc<int64_t>(m_source) - rc<int64_t>(m_landTrampolineAddr)) > 2000000000 /* 2 GB */) {
- Debug::log(ERR, "[functionhook] failed, source and trampo are over 2GB apart");
+ Log::logger->log(Log::ERR, "[functionhook] failed, source and trampo are over 2GB apart");
return false;
}
@@ -189,7 +189,7 @@ bool CFunctionHook::hook() {
const auto TRAMPOLINE_SIZE = sizeof(RELATIVE_JMP_ADDRESS) + HOOKSIZE;
if (TRAMPOLINE_SIZE > MAX_TRAMPOLINE_SIZE) {
- Debug::log(ERR, "[functionhook] failed, not enough space in trampo to alloc:\n{}", probe.assembly);
+ Log::logger->log(Log::ERR, "[functionhook] failed, not enough space in trampo to alloc:\n{}", probe.assembly);
return false;
}
@@ -300,7 +300,7 @@ static uintptr_t seekNewPageAddr() {
uint64_t start = 0, end = 0;
if (props[0].empty()) {
- Debug::log(WARN, "seekNewPageAddr: unexpected line in self maps");
+ Log::logger->log(Log::WARN, "seekNewPageAddr: unexpected line in self maps");
continue;
}
@@ -310,11 +310,11 @@ static uintptr_t seekNewPageAddr() {
start = std::stoull(startEnd[0], nullptr, 16);
end = std::stoull(startEnd[1], nullptr, 16);
} catch (std::exception& e) {
- Debug::log(WARN, "seekNewPageAddr: unexpected line in self maps: {}", line);
+ Log::logger->log(Log::WARN, "seekNewPageAddr: unexpected line in self maps: {}", line);
continue;
}
- Debug::log(LOG, "seekNewPageAddr: page 0x{:x} - 0x{:x}", start, end);
+ Log::logger->log(Log::DEBUG, "seekNewPageAddr: page 0x{:x} - 0x{:x}", start, end);
if (lastStart == 0) {
lastStart = start;
@@ -323,17 +323,17 @@ static uintptr_t seekNewPageAddr() {
}
if (!anchoredToHyprland && line.contains("Hyprland")) {
- Debug::log(LOG, "seekNewPageAddr: Anchored to hyprland at 0x{:x}", start);
+ Log::logger->log(Log::DEBUG, "seekNewPageAddr: Anchored to hyprland at 0x{:x}", start);
anchoredToHyprland = true;
} else if (start - lastEnd > PAGESIZE_VAR * 2) {
if (!anchoredToHyprland) {
- Debug::log(LOG, "seekNewPageAddr: skipping gap 0x{:x}-0x{:x}, not anchored to Hyprland code pages yet.", lastEnd, start);
+ Log::logger->log(Log::DEBUG, "seekNewPageAddr: skipping gap 0x{:x}-0x{:x}, not anchored to Hyprland code pages yet.", lastEnd, start);
lastStart = start;
lastEnd = end;
continue;
}
- Debug::log(LOG, "seekNewPageAddr: found gap: 0x{:x}-0x{:x} ({} bytes)", lastEnd, start, start - lastEnd);
+ Log::logger->log(Log::DEBUG, "seekNewPageAddr: found gap: 0x{:x}-0x{:x} ({} bytes)", lastEnd, start, start - lastEnd);
MAPS.close();
return lastEnd;
}
@@ -365,7 +365,7 @@ uint64_t CHookSystem::getAddressForTrampo() {
if (!page->addr) {
// allocate it
- Debug::log(LOG, "getAddressForTrampo: Allocating new page for hooks");
+ Log::logger->log(Log::DEBUG, "getAddressForTrampo: Allocating new page for hooks");
const uint64_t PAGESIZE_VAR = sysconf(_SC_PAGE_SIZE);
const auto BASEPAGEADDR = seekNewPageAddr();
for (int attempt = 0; attempt < 2; ++attempt) {
@@ -376,7 +376,7 @@ uint64_t CHookSystem::getAddressForTrampo() {
page->len = PAGESIZE_VAR;
page->used = 0;
- Debug::log(LOG, "Attempted to allocate 0x{:x}, got 0x{:x}", PAGEADDR, page->addr);
+ Log::logger->log(Log::DEBUG, "Attempted to allocate 0x{:x}, got 0x{:x}", PAGEADDR, page->addr);
if (page->addr == rc<uint64_t>(MAP_FAILED))
continue;
@@ -398,7 +398,7 @@ uint64_t CHookSystem::getAddressForTrampo() {
page->used += HOOK_TRAMPOLINE_MAX_SIZE;
- Debug::log(LOG, "getAddressForTrampo: Returning addr 0x{:x} for page at 0x{:x}", ADDRFORCONSUMER, page->addr);
+ Log::logger->log(Log::DEBUG, "getAddressForTrampo: Returning addr 0x{:x} for page at 0x{:x}", ADDRFORCONSUMER, page->addr);
return ADDRFORCONSUMER;
}
diff --git a/src/plugins/PluginAPI.cpp b/src/plugins/PluginAPI.cpp
index 66b0c74e..1d6586aa 100644
--- a/src/plugins/PluginAPI.cpp
+++ b/src/plugins/PluginAPI.cpp
@@ -350,11 +350,11 @@ APICALL std::vector<SFunctionMatch> HyprlandAPI::findFunctionsByName(HANDLE hand
};
if (SYMBOLS.empty()) {
- Debug::log(ERR, R"(Unable to search for function "{}": no symbols found in binary (is "{}" in path?))", name,
+ Log::logger->log(Log::ERR, R"(Unable to search for function "{}": no symbols found in binary (is "{}" in path?))", name,
#ifdef __clang__
- "llvm-nm"
+ "llvm-nm"
#else
- "nm"
+ "nm"
#endif
);
return {};
diff --git a/src/plugins/PluginSystem.cpp b/src/plugins/PluginSystem.cpp
index 27e8232e..53b05bc8 100644
--- a/src/plugins/PluginSystem.cpp
+++ b/src/plugins/PluginSystem.cpp
@@ -25,7 +25,7 @@ SP<CPromise<CPlugin*>> CPluginSystem::loadPlugin(const std::string& path, eSpeci
return CPromise<CPlugin*>::make([path, pid, pidType, this](SP<CPromiseResolver<CPlugin*>> resolver) {
const auto PERM = g_pDynamicPermissionManager->clientPermissionModeWithString(pidType != SPECIAL_PID_TYPE_NONE ? pidType : pid, path, PERMISSION_TYPE_PLUGIN);
if (PERM == PERMISSION_RULE_ALLOW_MODE_PENDING) {
- Debug::log(LOG, "CPluginSystem: Waiting for user confirmation to load {}", path);
+ Log::logger->log(Log::DEBUG, "CPluginSystem: Waiting for user confirmation to load {}", path);
auto promise = g_pDynamicPermissionManager->promiseFor(pid, path, PERMISSION_TYPE_PLUGIN);
if (!promise) { // already awaiting or something?
@@ -35,18 +35,18 @@ SP<CPromise<CPlugin*>> CPluginSystem::loadPlugin(const std::string& path, eSpeci
promise->then([this, path, resolver](SP<CPromiseResult<eDynamicPermissionAllowMode>> result) {
if (result->hasError()) {
- Debug::log(ERR, "CPluginSystem: Error spawning permission prompt");
+ Log::logger->log(Log::ERR, "CPluginSystem: Error spawning permission prompt");
resolver->reject("Error spawning permission prompt");
return;
}
if (result->result() != PERMISSION_RULE_ALLOW_MODE_ALLOW) {
- Debug::log(ERR, "CPluginSystem: Rejecting plugin load of {}, user denied", path);
+ Log::logger->log(Log::ERR, "CPluginSystem: Rejecting plugin load of {}, user denied", path);
resolver->reject("user denied");
return;
}
- Debug::log(LOG, "CPluginSystem: Loading {}, user allowed", path);
+ Log::logger->log(Log::DEBUG, "CPluginSystem: Loading {}, user allowed", path);
const auto RESULT = loadPluginInternal(path);
if (RESULT.has_value())
@@ -56,7 +56,7 @@ SP<CPromise<CPlugin*>> CPluginSystem::loadPlugin(const std::string& path, eSpeci
});
return;
} else if (PERM == PERMISSION_RULE_ALLOW_MODE_DENY) {
- Debug::log(LOG, "CPluginSystem: Rejecting plugin load, permission is disabled");
+ Log::logger->log(Log::DEBUG, "CPluginSystem: Rejecting plugin load, permission is disabled");
resolver->reject("permission is disabled");
return;
}
@@ -71,7 +71,7 @@ SP<CPromise<CPlugin*>> CPluginSystem::loadPlugin(const std::string& path, eSpeci
std::expected<CPlugin*, std::string> CPluginSystem::loadPluginInternal(const std::string& path) {
if (getPluginByPath(path)) {
- Debug::log(ERR, " [PluginSystem] Cannot load a plugin twice!");
+ Log::logger->log(Log::ERR, " [PluginSystem] Cannot load a plugin twice!");
return std::unexpected("Cannot load a plugin twice!");
}
@@ -83,7 +83,7 @@ std::expected<CPlugin*, std::string> CPluginSystem::loadPluginInternal(const std
if (!MODULE) {
std::string strerr = dlerror();
- Debug::log(ERR, " [PluginSystem] Plugin {} could not be loaded: {}", path, strerr);
+ Log::logger->log(Log::ERR, " [PluginSystem] Plugin {} could not be loaded: {}", path, strerr);
m_loadedPlugins.pop_back();
return std::unexpected(std::format("Plugin {} could not be loaded: {}", path, strerr));
}
@@ -94,7 +94,7 @@ std::expected<CPlugin*, std::string> CPluginSystem::loadPluginInternal(const std
PPLUGIN_INIT_FUNC initFunc = rc<PPLUGIN_INIT_FUNC>(dlsym(MODULE, PLUGIN_INIT_FUNC_STR));
if (!apiVerFunc || !initFunc) {
- Debug::log(ERR, " [PluginSystem] Plugin {} could not be loaded. (No apiver/init func)", path);
+ Log::logger->log(Log::ERR, " [PluginSystem] Plugin {} could not be loaded. (No apiver/init func)", path);
dlclose(MODULE);
m_loadedPlugins.pop_back();
return std::unexpected(std::format("Plugin {} could not be loaded: {}", path, "missing apiver/init func"));
@@ -103,7 +103,7 @@ std::expected<CPlugin*, std::string> CPluginSystem::loadPluginInternal(const std
const std::string PLUGINAPIVER = apiVerFunc();
if (PLUGINAPIVER != HYPRLAND_API_VERSION) {
- Debug::log(ERR, " [PluginSystem] Plugin {} could not be loaded. (API version mismatch)", path);
+ Log::logger->log(Log::ERR, " [PluginSystem] Plugin {} could not be loaded. (API version mismatch)", path);
dlclose(MODULE);
m_loadedPlugins.pop_back();
return std::unexpected(std::format("Plugin {} could not be loaded: {}", path, "API version mismatch"));
@@ -121,7 +121,7 @@ std::expected<CPlugin*, std::string> CPluginSystem::loadPluginInternal(const std
}
} catch (std::exception& e) {
m_allowConfigVars = false;
- Debug::log(ERR, " [PluginSystem] Plugin {} (Handle {:x}) crashed in init. Unloading.", path, rc<uintptr_t>(MODULE));
+ Log::logger->log(Log::ERR, " [PluginSystem] Plugin {} (Handle {:x}) crashed in init. Unloading.", path, rc<uintptr_t>(MODULE));
unloadPlugin(PLUGIN, true); // Plugin could've already hooked/done something
return std::unexpected(std::format("Plugin {} could not be loaded: plugin crashed/threw in main: {}", path, e.what()));
}
@@ -135,8 +135,8 @@ std::expected<CPlugin*, std::string> CPluginSystem::loadPluginInternal(const std
g_pEventLoopManager->doLater([] { g_pConfigManager->reload(); });
- Debug::log(LOG, R"( [PluginSystem] Plugin {} loaded. Handle: {:x}, path: "{}", author: "{}", description: "{}", version: "{}")", PLUGINDATA.name, rc<uintptr_t>(MODULE), path,
- PLUGINDATA.author, PLUGINDATA.description, PLUGINDATA.version);
+ Log::logger->log(Log::DEBUG, R"( [PluginSystem] Plugin {} loaded. Handle: {:x}, path: "{}", author: "{}", description: "{}", version: "{}")", PLUGINDATA.name,
+ rc<uintptr_t>(MODULE), path, PLUGINDATA.author, PLUGINDATA.description, PLUGINDATA.version);
return PLUGIN;
}
@@ -185,7 +185,7 @@ void CPluginSystem::unloadPlugin(const CPlugin* plugin, bool eject) {
dlclose(PLHANDLE);
- Debug::log(LOG, " [PluginSystem] Plugin {} unloaded.", PLNAME);
+ Log::logger->log(Log::DEBUG, " [PluginSystem] Plugin {} unloaded.", PLNAME);
// reload config to fix some stuf like e.g. unloadedPluginVars
g_pEventLoopManager->doLater([] { g_pConfigManager->reload(); });
@@ -207,7 +207,7 @@ void CPluginSystem::updateConfigPlugins(const std::vector<std::string>& plugins,
if (!p->m_loadedWithConfig || std::ranges::find(plugins, p->m_path) != plugins.end())
continue;
- Debug::log(LOG, "Unloading plugin {} which is no longer present in config", p->m_path);
+ Log::logger->log(Log::DEBUG, "Unloading plugin {} which is no longer present in config", p->m_path);
unloadPlugin(p.get(), false);
changed = true;
}
@@ -217,14 +217,14 @@ void CPluginSystem::updateConfigPlugins(const std::vector<std::string>& plugins,
if (std::ranges::find_if(m_loadedPlugins, [&](const auto& other) { return other->m_path == path; }) != m_loadedPlugins.end())
continue;
- Debug::log(LOG, "Loading plugin {} which is now present in config", path);
+ Log::logger->log(Log::DEBUG, "Loading plugin {} which is now present in config", path);
changed = true;
loadPlugin(path, SPECIAL_PID_TYPE_CONFIG)->then([path](SP<CPromiseResult<CPlugin*>> result) {
if (result->hasError()) {
const auto NAME = path.contains('/') ? path.substr(path.find_last_of('/') + 1) : path;
- Debug::log(ERR, "CPluginSystem::updateConfigPlugins: failed to load plugin {}: {}", NAME, result->error());
+ Log::logger->log(Log::ERR, "CPluginSystem::updateConfigPlugins: failed to load plugin {}: {}", NAME, result->error());
g_pHyprNotificationOverlay->addNotification(I18n::i18nEngine()->localize(I18n::TXT_KEY_NOTIF_FAILED_TO_LOAD_PLUGIN, {{"name", NAME}, {"error", result->error()}}),
CHyprColor{0, 0, 0, 0}, 5000, ICON_ERROR);
return;
@@ -232,7 +232,7 @@ void CPluginSystem::updateConfigPlugins(const std::vector<std::string>& plugins,
result->result()->m_loadedWithConfig = true;
- Debug::log(LOG, "CPluginSystem::updateConfigPlugins: loaded {}", path);
+ Log::logger->log(Log::DEBUG, "CPluginSystem::updateConfigPlugins: loaded {}", path);
});
}
}
diff --git a/src/protocols/AlphaModifier.cpp b/src/protocols/AlphaModifier.cpp
index 167abe53..a4ebc635 100644
--- a/src/protocols/AlphaModifier.cpp
+++ b/src/protocols/AlphaModifier.cpp
@@ -85,7 +85,7 @@ void CAlphaModifierProtocol::getSurface(CWpAlphaModifierV1* manager, uint32_t id
if (iter != m_alphaModifiers.end()) {
if (iter->second->m_resource) {
- LOGM(ERR, "AlphaModifier already present for surface {:x}", (uintptr_t)surface.get());
+ LOGM(Log::ERR, "AlphaModifier already present for surface {:x}", (uintptr_t)surface.get());
manager->error(WP_ALPHA_MODIFIER_V1_ERROR_ALREADY_CONSTRUCTED, "AlphaModifier already present");
return;
} else {
diff --git a/src/protocols/CTMControl.cpp b/src/protocols/CTMControl.cpp
index 9c241942..f94792dc 100644
--- a/src/protocols/CTMControl.cpp
+++ b/src/protocols/CTMControl.cpp
@@ -42,14 +42,14 @@ CHyprlandCTMControlResource::CHyprlandCTMControlResource(UP<CHyprlandCtmControlM
m_ctms[PMONITOR->m_name] = MAT;
- LOGM(LOG, "CTM set for output {}: {}", PMONITOR->m_name, m_ctms.at(PMONITOR->m_name).toString());
+ LOGM(Log::DEBUG, "CTM set for output {}: {}", PMONITOR->m_name, m_ctms.at(PMONITOR->m_name).toString());
});
m_resource->setCommit([this](CHyprlandCtmControlManagerV1* r) {
if (m_blocked)
return;
- LOGM(LOG, "Committing ctms to outputs");
+ LOGM(Log::DEBUG, "Committing ctms to outputs");
for (auto& m : g_pCompositor->m_monitors) {
if (!m_ctms.contains(m->m_name)) {
@@ -100,7 +100,7 @@ void CHyprlandCTMControlProtocol::bindManager(wl_client* client, void* data, uin
else
m_manager = RESOURCE;
- LOGM(LOG, "New CTM Manager at 0x{:x}", (uintptr_t)RESOURCE.get());
+ LOGM(Log::DEBUG, "New CTM Manager at 0x{:x}", (uintptr_t)RESOURCE.get());
}
void CHyprlandCTMControlProtocol::destroyResource(CHyprlandCTMControlResource* res) {
diff --git a/src/protocols/ColorManagement.cpp b/src/protocols/ColorManagement.cpp
index 408ade4d..4215a5e7 100644
--- a/src/protocols/ColorManagement.cpp
+++ b/src/protocols/ColorManagement.cpp
@@ -62,9 +62,9 @@ CColorManager::CColorManager(SP<CWpColorManagerV1> resource) : m_resource(resour
m_resource->sendSupportedIntent(WP_COLOR_MANAGER_V1_RENDER_INTENT_RELATIVE_BPC);
}
- m_resource->setDestroy([](CWpColorManagerV1* r) { LOGM(TRACE, "Destroy WP_color_manager at {:x} (generated default)", (uintptr_t)r); });
+ m_resource->setDestroy([](CWpColorManagerV1* r) { LOGM(Log::TRACE, "Destroy WP_color_manager at {:x} (generated default)", (uintptr_t)r); });
m_resource->setGetOutput([](CWpColorManagerV1* r, uint32_t id, wl_resource* output) {
- LOGM(TRACE, "Get output for id={}, output={}", id, (uintptr_t)output);
+ LOGM(Log::TRACE, "Get output for id={}, output={}", id, (uintptr_t)output);
const auto OUTPUTRESOURCE = CWLOutputResource::fromResource(output);
@@ -80,11 +80,11 @@ CColorManager::CColorManager(SP<CWpColorManagerV1> resource) : m_resource(resour
RESOURCE->m_self = RESOURCE;
});
m_resource->setGetSurface([](CWpColorManagerV1* r, uint32_t id, wl_resource* surface) {
- LOGM(TRACE, "Get surface for id={}, surface={}", id, (uintptr_t)surface);
+ LOGM(Log::TRACE, "Get surface for id={}, surface={}", id, (uintptr_t)surface);
auto SURF = CWLSurfaceResource::fromResource(surface);
if (!SURF) {
- LOGM(ERR, "No surface for resource {}", (uintptr_t)surface);
+ LOGM(Log::ERR, "No surface for resource {}", (uintptr_t)surface);
r->error(-1, "Invalid surface (2)");
return;
}
@@ -107,11 +107,11 @@ CColorManager::CColorManager(SP<CWpColorManagerV1> resource) : m_resource(resour
SURF->m_colorManagement = RESOURCE;
});
m_resource->setGetSurfaceFeedback([](CWpColorManagerV1* r, uint32_t id, wl_resource* surface) {
- LOGM(TRACE, "Get feedback surface for id={}, surface={}", id, (uintptr_t)surface);
+ LOGM(Log::TRACE, "Get feedback surface for id={}, surface={}", id, (uintptr_t)surface);
auto SURF = CWLSurfaceResource::fromResource(surface);
if (!SURF) {
- LOGM(ERR, "No surface for resource {}", (uintptr_t)surface);
+ LOGM(Log::ERR, "No surface for resource {}", (uintptr_t)surface);
r->error(-1, "Invalid surface (2)");
return;
}
@@ -128,7 +128,7 @@ CColorManager::CColorManager(SP<CWpColorManagerV1> resource) : m_resource(resour
RESOURCE->m_self = RESOURCE;
});
m_resource->setCreateIccCreator([](CWpColorManagerV1* r, uint32_t id) {
- LOGM(WARN, "New ICC creator for id={} (unsupported)", id);
+ LOGM(Log::WARN, "New ICC creator for id={} (unsupported)", id);
if (!PROTO::colorManagement->m_debug) {
r->error(WP_COLOR_MANAGER_V1_ERROR_UNSUPPORTED_FEATURE, "ICC profiles are not supported");
return;
@@ -146,7 +146,7 @@ CColorManager::CColorManager(SP<CWpColorManagerV1> resource) : m_resource(resour
RESOURCE->m_self = RESOURCE;
});
m_resource->setCreateParametricCreator([](CWpColorManagerV1* r, uint32_t id) {
- LOGM(TRACE, "New parametric creator for id={}", id);
+ LOGM(Log::TRACE, "New parametric creator for id={}", id);
const auto RESOURCE = PROTO::colorManagement->m_parametricCreators.emplace_back(
makeShared<CColorManagementParametricCreator>(makeShared<CWpImageDescriptionCreatorParamsV1>(r->client(), r->version(), id)));
@@ -160,7 +160,7 @@ CColorManager::CColorManager(SP<CWpColorManagerV1> resource) : m_resource(resour
RESOURCE->m_self = RESOURCE;
});
m_resource->setCreateWindowsScrgb([](CWpColorManagerV1* r, uint32_t id) {
- LOGM(WARN, "New Windows scRGB description id={}", id);
+ LOGM(Log::WARN, "New Windows scRGB description id={}", id);
const auto RESOURCE = PROTO::colorManagement->m_imageDescriptions.emplace_back(
makeShared<CColorManagementImageDescription>(makeShared<CWpImageDescriptionV1>(r->client(), r->version(), id), false));
@@ -204,7 +204,7 @@ CColorManagementOutput::CColorManagementOutput(SP<CWpColorManagementOutputV1> re
m_resource->setOnDestroy([this](CWpColorManagementOutputV1* r) { PROTO::colorManagement->destroyResource(this); });
m_resource->setGetImageDescription([this](CWpColorManagementOutputV1* r, uint32_t id) {
- LOGM(TRACE, "Get image description for output={}, id={}", (uintptr_t)r, id);
+ LOGM(Log::TRACE, "Get image description for output={}, id={}", (uintptr_t)r, id);
if (m_imageDescription.valid())
PROTO::colorManagement->destroyResource(m_imageDescription.get());
@@ -247,16 +247,16 @@ CColorManagementSurface::CColorManagementSurface(SP<CWpColorManagementSurfaceV1>
m_client = m_resource->client();
m_resource->setDestroy([this](CWpColorManagementSurfaceV1* r) {
- LOGM(TRACE, "Destroy wp cm surface {}", (uintptr_t)m_surface);
+ LOGM(Log::TRACE, "Destroy wp cm surface {}", (uintptr_t)m_surface);
PROTO::colorManagement->destroyResource(this);
});
m_resource->setOnDestroy([this](CWpColorManagementSurfaceV1* r) {
- LOGM(TRACE, "Destroy wp cm surface {}", (uintptr_t)m_surface);
+ LOGM(Log::TRACE, "Destroy wp cm surface {}", (uintptr_t)m_surface);
PROTO::colorManagement->destroyResource(this);
});
m_resource->setSetImageDescription([this](CWpColorManagementSurfaceV1* r, wl_resource* image_description, uint32_t render_intent) {
- LOGM(TRACE, "Set image description for surface={}, desc={}, intent={}", (uintptr_t)r, (uintptr_t)image_description, render_intent);
+ LOGM(Log::TRACE, "Set image description for surface={}, desc={}, intent={}", (uintptr_t)r, (uintptr_t)image_description, render_intent);
const auto PO = sc<CWpImageDescriptionV1*>(wl_resource_get_user_data(image_description));
if (!PO) { // FIXME check validity
@@ -279,7 +279,7 @@ CColorManagementSurface::CColorManagementSurface(SP<CWpColorManagementSurfaceV1>
m_imageDescription = imageDescription->get()->m_settings;
});
m_resource->setUnsetImageDescription([this](CWpColorManagementSurfaceV1* r) {
- LOGM(TRACE, "Unset image description for surface={}", (uintptr_t)r);
+ LOGM(Log::TRACE, "Unset image description for surface={}", (uintptr_t)r);
m_imageDescription = SImageDescription{};
setHasImageDescription(false);
});
@@ -295,7 +295,7 @@ wl_client* CColorManagementSurface::client() {
const SImageDescription& CColorManagementSurface::imageDescription() {
if (!hasImageDescription())
- LOGM(WARN, "Reading imageDescription while none set. Returns default or empty values");
+ LOGM(Log::WARN, "Reading imageDescription while none set. Returns default or empty values");
return m_imageDescription;
}
@@ -344,16 +344,16 @@ CColorManagementFeedbackSurface::CColorManagementFeedbackSurface(SP<CWpColorMana
m_client = m_resource->client();
m_resource->setDestroy([this](CWpColorManagementSurfaceFeedbackV1* r) {
- LOGM(TRACE, "Destroy wp cm feedback surface {}", (uintptr_t)m_surface);
+ LOGM(Log::TRACE, "Destroy wp cm feedback surface {}", (uintptr_t)m_surface);
PROTO::colorManagement->destroyResource(this);
});
m_resource->setOnDestroy([this](CWpColorManagementSurfaceFeedbackV1* r) {
- LOGM(TRACE, "Destroy wp cm feedback surface {}", (uintptr_t)m_surface);
+ LOGM(Log::TRACE, "Destroy wp cm feedback surface {}", (uintptr_t)m_surface);
PROTO::colorManagement->destroyResource(this);
});
m_resource->setGetPreferred([this](CWpColorManagementSurfaceFeedbackV1* r, uint32_t id) {
- LOGM(TRACE, "Get preferred for id {}", id);
+ LOGM(Log::TRACE, "Get preferred for id {}", id);
if (m_surface.expired()) {
r->error(WP_COLOR_MANAGEMENT_SURFACE_FEEDBACK_V1_ERROR_INERT, "Surface is inert");
@@ -376,7 +376,7 @@ CColorManagementFeedbackSurface::CColorManagementFeedbackSurface(SP<CWpColorMana
});
m_resource->setGetPreferredParametric([this](CWpColorManagementSurfaceFeedbackV1* r, uint32_t id) {
- LOGM(TRACE, "Get preferred for id {}", id);
+ LOGM(Log::TRACE, "Get preferred for id {}", id);
if (m_surface.expired()) {
r->error(WP_COLOR_MANAGEMENT_SURFACE_FEEDBACK_V1_ERROR_INERT, "Surface is inert");
@@ -397,7 +397,7 @@ CColorManagementFeedbackSurface::CColorManagementFeedbackSurface(SP<CWpColorMana
m_currentPreferredId = RESOURCE->m_settings.updateId();
if (!PROTO::colorManagement->m_debug && RESOURCE->m_settings.icc.fd >= 0) {
- LOGM(ERR, "FIXME: parse icc profile");
+ LOGM(Log::ERR, "FIXME: parse icc profile");
r->error(WP_COLOR_MANAGER_V1_ERROR_UNSUPPORTED_FEATURE, "ICC profiles are not supported");
return;
}
@@ -434,7 +434,7 @@ CColorManagementIccCreator::CColorManagementIccCreator(SP<CWpImageDescriptionCre
m_resource->setOnDestroy([this](CWpImageDescriptionCreatorIccV1* r) { PROTO::colorManagement->destroyResource(this); });
m_resource->setCreate([this](CWpImageDescriptionCreatorIccV1* r, uint32_t id) {
- LOGM(TRACE, "Create image description from icc for id {}", id);
+ LOGM(Log::TRACE, "Create image description from icc for id {}", id);
// FIXME actually check completeness
if (m_settings.icc.fd < 0 || !m_settings.icc.length) {
@@ -451,7 +451,7 @@ CColorManagementIccCreator::CColorManagementIccCreator(SP<CWpImageDescriptionCre
return;
}
- LOGM(ERR, "FIXME: Parse icc file {}({},{}) for id {}", m_settings.icc.fd, m_settings.icc.offset, m_settings.icc.length, id);
+ LOGM(Log::ERR, "FIXME: Parse icc file {}({},{}) for id {}", m_settings.icc.fd, m_settings.icc.offset, m_settings.icc.length, id);
// FIXME actually check support
if (m_settings.icc.fd < 0 || !m_settings.icc.length) {
@@ -490,7 +490,7 @@ CColorManagementParametricCreator::CColorManagementParametricCreator(SP<CWpImage
m_resource->setOnDestroy([this](CWpImageDescriptionCreatorParamsV1* r) { PROTO::colorManagement->destroyResource(this); });
m_resource->setCreate([this](CWpImageDescriptionCreatorParamsV1* r, uint32_t id) {
- LOGM(TRACE, "Create image description from params for id {}", id);
+ LOGM(Log::TRACE, "Create image description from params for id {}", id);
// FIXME actually check completeness
if (!m_valuesSet) {
@@ -520,7 +520,7 @@ CColorManagementParametricCreator::CColorManagementParametricCreator(SP<CWpImage
PROTO::colorManagement->destroyResource(this);
});
m_resource->setSetTfNamed([this](CWpImageDescriptionCreatorParamsV1* r, uint32_t tf) {
- LOGM(TRACE, "Set image description transfer function to {}", tf);
+ LOGM(Log::TRACE, "Set image description transfer function to {}", tf);
if (m_valuesSet & PC_TF) {
r->error(WP_IMAGE_DESCRIPTION_CREATOR_PARAMS_V1_ERROR_ALREADY_SET, "Transfer function already set");
return;
@@ -547,7 +547,7 @@ CColorManagementParametricCreator::CColorManagementParametricCreator(SP<CWpImage
m_valuesSet |= PC_TF;
});
m_resource->setSetTfPower([this](CWpImageDescriptionCreatorParamsV1* r, uint32_t eexp) {
- LOGM(TRACE, "Set image description tf power to {}", eexp);
+ LOGM(Log::TRACE, "Set image description tf power to {}", eexp);
if (m_valuesSet & PC_TF_POWER) {
r->error(WP_IMAGE_DESCRIPTION_CREATOR_PARAMS_V1_ERROR_ALREADY_SET, "Transfer function power already set");
return;
@@ -564,7 +564,7 @@ CColorManagementParametricCreator::CColorManagementParametricCreator(SP<CWpImage
m_valuesSet |= PC_TF_POWER;
});
m_resource->setSetPrimariesNamed([this](CWpImageDescriptionCreatorParamsV1* r, uint32_t primaries) {
- LOGM(TRACE, "Set image description primaries by name {}", primaries);
+ LOGM(Log::TRACE, "Set image description primaries by name {}", primaries);
if (m_valuesSet & PC_PRIMARIES) {
r->error(WP_IMAGE_DESCRIPTION_CREATOR_PARAMS_V1_ERROR_ALREADY_SET, "Primaries already set");
return;
@@ -594,7 +594,7 @@ CColorManagementParametricCreator::CColorManagementParametricCreator(SP<CWpImage
});
m_resource->setSetPrimaries(
[this](CWpImageDescriptionCreatorParamsV1* r, int32_t r_x, int32_t r_y, int32_t g_x, int32_t g_y, int32_t b_x, int32_t b_y, int32_t w_x, int32_t w_y) {
- LOGM(TRACE, "Set image description primaries by values r:{},{} g:{},{} b:{},{} w:{},{}", r_x, r_y, g_x, g_y, b_x, b_y, w_x, w_y);
+ LOGM(Log::TRACE, "Set image description primaries by values r:{},{} g:{},{} b:{},{} w:{},{}", r_x, r_y, g_x, g_y, b_x, b_y, w_x, w_y);
if (m_valuesSet & PC_PRIMARIES) {
r->error(WP_IMAGE_DESCRIPTION_CREATOR_PARAMS_V1_ERROR_ALREADY_SET, "Primaries already set");
return;
@@ -608,7 +608,7 @@ CColorManagementParametricCreator::CColorManagementParametricCreator(SP<CWpImage
});
m_resource->setSetLuminances([this](CWpImageDescriptionCreatorParamsV1* r, uint32_t min_lum, uint32_t max_lum, uint32_t reference_lum) {
auto min = min_lum / 10000.0f;
- LOGM(TRACE, "Set image description luminances to {} - {} ({})", min, max_lum, reference_lum);
+ LOGM(Log::TRACE, "Set image description luminances to {} - {} ({})", min, max_lum, reference_lum);
if (m_valuesSet & PC_LUMINANCES) {
r->error(WP_IMAGE_DESCRIPTION_CREATOR_PARAMS_V1_ERROR_ALREADY_SET, "Luminances already set");
return;
@@ -622,7 +622,7 @@ CColorManagementParametricCreator::CColorManagementParametricCreator(SP<CWpImage
});
m_resource->setSetMasteringDisplayPrimaries(
[this](CWpImageDescriptionCreatorParamsV1* r, int32_t r_x, int32_t r_y, int32_t g_x, int32_t g_y, int32_t b_x, int32_t b_y, int32_t w_x, int32_t w_y) {
- LOGM(TRACE, "Set image description mastering primaries by values r:{},{} g:{},{} b:{},{} w:{},{}", r_x, r_y, g_x, g_y, b_x, b_y, w_x, w_y);
+ LOGM(Log::TRACE, "Set image description mastering primaries by values r:{},{} g:{},{} b:{},{} w:{},{}", r_x, r_y, g_x, g_y, b_x, b_y, w_x, w_y);
if (m_valuesSet & PC_MASTERING_PRIMARIES) {
r->error(WP_IMAGE_DESCRIPTION_CREATOR_PARAMS_V1_ERROR_ALREADY_SET, "Mastering primaries already set");
return;
@@ -644,7 +644,7 @@ CColorManagementParametricCreator::CColorManagementParametricCreator(SP<CWpImage
});
m_resource->setSetMasteringLuminance([this](CWpImageDescriptionCreatorParamsV1* r, uint32_t min_lum, uint32_t max_lum) {
auto min = min_lum / 10000.0f;
- LOGM(TRACE, "Set image description mastering luminances to {} - {}", min, max_lum);
+ LOGM(Log::TRACE, "Set image description mastering luminances to {} - {}", min, max_lum);
// if (valuesSet & PC_MASTERING_LUMINANCES) {
// r->error(WP_IMAGE_DESCRIPTION_CREATOR_PARAMS_V1_ERROR_ALREADY_SET, "Mastering luminances already set");
// return;
@@ -661,7 +661,7 @@ CColorManagementParametricCreator::CColorManagementParametricCreator(SP<CWpImage
m_valuesSet |= PC_MASTERING_LUMINANCES;
});
m_resource->setSetMaxCll([this](CWpImageDescriptionCreatorParamsV1* r, uint32_t max_cll) {
- LOGM(TRACE, "Set image description max content light level to {}", max_cll);
+ LOGM(Log::TRACE, "Set image description max content light level to {}", max_cll);
// if (valuesSet & PC_CLL) {
// r->error(WP_IMAGE_DESCRIPTION_CREATOR_PARAMS_V1_ERROR_ALREADY_SET, "Max CLL already set");
// return;
@@ -670,7 +670,7 @@ CColorManagementParametricCreator::CColorManagementParametricCreator(SP<CWpImage
m_valuesSet |= PC_CLL;
});
m_resource->setSetMaxFall([this](CWpImageDescriptionCreatorParamsV1* r, uint32_t max_fall) {
- LOGM(TRACE, "Set image description max frame-average light level to {}", max_fall);
+ LOGM(Log::TRACE, "Set image description max frame-average light level to {}", max_fall);
// if (valuesSet & PC_FALL) {
// r->error(WP_IMAGE_DESCRIPTION_CREATOR_PARAMS_V1_ERROR_ALREADY_SET, "Max FALL already set");
// return;
@@ -699,7 +699,7 @@ CColorManagementImageDescription::CColorManagementImageDescription(SP<CWpImageDe
m_resource->setOnDestroy([this](CWpImageDescriptionV1* r) { PROTO::colorManagement->destroyResource(this); });
m_resource->setGetInformation([this](CWpImageDescriptionV1* r, uint32_t id) {
- LOGM(TRACE, "Get image information for image={}, id={}", (uintptr_t)r, id);
+ LOGM(Log::TRACE, "Get image information for image={}, id={}", (uintptr_t)r, id);
if (!m_allowGetInformation) {
r->error(WP_IMAGE_DESCRIPTION_V1_ERROR_NO_INFORMATION, "Image descriptions doesn't allow get_information request");
return;
@@ -782,7 +782,7 @@ void CColorManagementProtocol::bindManager(wl_client* client, void* data, uint32
return;
}
- LOGM(TRACE, "New WP_color_manager at {:x}", (uintptr_t)RESOURCE.get());
+ LOGM(Log::TRACE, "New WP_color_manager at {:x}", (uintptr_t)RESOURCE.get());
}
void CColorManagementProtocol::onImagePreferredChanged(uint32_t preferredId) {
diff --git a/src/protocols/ContentType.cpp b/src/protocols/ContentType.cpp
index c32f54a2..7c8fdbc3 100644
--- a/src/protocols/ContentType.cpp
+++ b/src/protocols/ContentType.cpp
@@ -10,11 +10,11 @@ CContentTypeManager::CContentTypeManager(SP<CWpContentTypeManagerV1> resource) :
m_resource->setOnDestroy([this](CWpContentTypeManagerV1* r) { PROTO::contentType->destroyResource(this); });
m_resource->setGetSurfaceContentType([](CWpContentTypeManagerV1* r, uint32_t id, wl_resource* surface) {
- LOGM(TRACE, "Get surface for id={}, surface={}", id, (uintptr_t)surface);
+ LOGM(Log::TRACE, "Get surface for id={}, surface={}", id, (uintptr_t)surface);
auto SURF = CWLSurfaceResource::fromResource(surface);
if (!SURF) {
- LOGM(ERR, "No surface for resource {}", (uintptr_t)surface);
+ LOGM(Log::ERR, "No surface for resource {}", (uintptr_t)surface);
r->error(-1, "Invalid surface (2)");
return;
}
diff --git a/src/protocols/DRMLease.cpp b/src/protocols/DRMLease.cpp
index 260497d3..2da7b04a 100644
--- a/src/protocols/DRMLease.cpp
+++ b/src/protocols/DRMLease.cpp
@@ -27,7 +27,7 @@ CDRMLeaseResource::CDRMLeaseResource(SP<CWpDrmLeaseV1> resource_, SP<CDRMLeaseRe
for (auto const& m : m_requested) {
if (!m->m_monitor || m->m_monitor->m_isBeingLeased) {
- LOGM(ERR, "Rejecting lease: no monitor or monitor is being leased for {}", (m->m_monitor ? m->m_monitor->m_name : "null"));
+ LOGM(Log::ERR, "Rejecting lease: no monitor or monitor is being leased for {}", (m->m_monitor ? m->m_monitor->m_name : "null"));
m_resource->sendFinished();
return;
}
@@ -35,7 +35,7 @@ CDRMLeaseResource::CDRMLeaseResource(SP<CWpDrmLeaseV1> resource_, SP<CDRMLeaseRe
// grant the lease if it is seemingly valid
- LOGM(LOG, "Leasing outputs: {}", [this]() {
+ LOGM(Log::DEBUG, "Leasing outputs: {}", [this]() {
std::string roll;
for (auto const& o : m_requested) {
roll += std::format("{} ", o->m_monitor->m_name);
@@ -53,7 +53,7 @@ CDRMLeaseResource::CDRMLeaseResource(SP<CWpDrmLeaseV1> resource_, SP<CDRMLeaseRe
auto aqlease = Aquamarine::CDRMLease::create(outputs);
if (!aqlease) {
- LOGM(ERR, "Rejecting lease: backend failed to alloc a lease");
+ LOGM(Log::ERR, "Rejecting lease: backend failed to alloc a lease");
m_resource->sendFinished();
return;
}
@@ -71,10 +71,10 @@ CDRMLeaseResource::CDRMLeaseResource(SP<CWpDrmLeaseV1> resource_, SP<CDRMLeaseRe
}
m_resource->sendFinished();
- LOGM(LOG, "Revoking lease for fd {}", m_lease->leaseFD);
+ LOGM(Log::DEBUG, "Revoking lease for fd {}", m_lease->leaseFD);
});
- LOGM(LOG, "Granting lease, sending fd {}", m_lease->leaseFD);
+ LOGM(Log::DEBUG, "Granting lease, sending fd {}", m_lease->leaseFD);
m_resource->sendLeaseFd(m_lease->leaseFD);
@@ -211,18 +211,18 @@ CDRMLeaseDeviceResource::CDRMLeaseDeviceResource(std::string deviceName_, SP<CWp
PROTO::lease.at(m_deviceName)->m_requests.emplace_back(RESOURCE);
- LOGM(LOG, "New lease request {}", id);
+ LOGM(Log::DEBUG, "New lease request {}", id);
RESOURCE->m_parent = m_self;
});
CFileDescriptor fd{PROTO::lease.at(m_deviceName)->m_backend.get()->getNonMasterFD()};
if (!fd.isValid()) {
- LOGM(ERR, "Failed to dup fd in lease");
+ LOGM(Log::ERR, "Failed to dup fd in lease");
return;
}
- LOGM(LOG, "Sending DRMFD {} to new lease device", fd.get());
+ LOGM(Log::DEBUG, "Sending DRMFD {} to new lease device", fd.get());
m_resource->sendDrmFd(fd.get());
for (auto const& m : PROTO::lease.at(m_deviceName)->m_offeredOutputs) {
@@ -250,7 +250,7 @@ void CDRMLeaseDeviceResource::sendConnector(PHLMONITOR monitor) {
RESOURCE->m_parent = m_self;
RESOURCE->m_self = RESOURCE;
- LOGM(LOG, "Sending new connector {}", monitor->m_name);
+ LOGM(Log::DEBUG, "Sending new connector {}", monitor->m_name);
m_connectorsSent.emplace_back(RESOURCE);
PROTO::lease.at(m_deviceName)->m_connectors.emplace_back(RESOURCE);
@@ -271,7 +271,7 @@ CDRMLeaseProtocol::CDRMLeaseProtocol(const wl_interface* iface, const int& ver,
CFileDescriptor fd{m_backend->getNonMasterFD()};
if (!fd.isValid()) {
- LOGM(ERR, "Failed to dup fd for drm node {}", m_deviceName);
+ LOGM(Log::ERR, "Failed to dup fd for drm node {}", m_deviceName);
return;
}
@@ -318,7 +318,7 @@ void CDRMLeaseProtocol::offer(PHLMONITOR monitor) {
return;
if (monitor->m_output->getBackend() != m_backend) {
- LOGM(ERR, "Monitor {} cannot be leased: lease is for a different device", monitor->m_name);
+ LOGM(Log::ERR, "Monitor {} cannot be leased: lease is for a different device", monitor->m_name);
return;
}
diff --git a/src/protocols/DRMSyncobj.cpp b/src/protocols/DRMSyncobj.cpp
index 40869c0d..821796d0 100644
--- a/src/protocols/DRMSyncobj.cpp
+++ b/src/protocols/DRMSyncobj.cpp
@@ -21,7 +21,7 @@ WP<CSyncTimeline> CDRMSyncPointState::timeline() {
UP<CSyncReleaser> CDRMSyncPointState::createSyncRelease() {
if (m_releaseTaken)
- Debug::log(ERR, "CDRMSyncPointState: creating a sync releaser on an already created SyncRelease");
+ Log::logger->log(Log::ERR, "CDRMSyncPointState: creating a sync releaser on an already created SyncRelease");
m_releaseTaken = true;
return makeUnique<CSyncReleaser>(m_timeline, m_point);
@@ -180,7 +180,7 @@ CDRMSyncobjManagerResource::CDRMSyncobjManagerResource(UP<CWpLinuxDrmSyncobjMana
SURF->m_syncobj = RESOURCE;
- LOGM(LOG, "New linux_syncobj at {:x} for surface {:x}", (uintptr_t)RESOURCE.get(), (uintptr_t)SURF.get());
+ LOGM(Log::DEBUG, "New linux_syncobj at {:x} for surface {:x}", (uintptr_t)RESOURCE.get(), (uintptr_t)SURF.get());
});
m_resource->setImportTimeline([this](CWpLinuxDrmSyncobjManagerV1* r, uint32_t id, int32_t fd) {
@@ -192,7 +192,7 @@ CDRMSyncobjManagerResource::CDRMSyncobjManagerResource(UP<CWpLinuxDrmSyncobjMana
return;
}
- LOGM(LOG, "New linux_drm_timeline at {:x}", (uintptr_t)RESOURCE.get());
+ LOGM(Log::DEBUG, "New linux_drm_timeline at {:x}", (uintptr_t)RESOURCE.get());
});
}
@@ -206,11 +206,11 @@ CDRMSyncobjProtocol::CDRMSyncobjProtocol(const wl_interface* iface, const int& v
else if (g_pCompositor->m_drm.syncobjSupport)
m_drmFD = g_pCompositor->m_drm.fd;
else {
- LOGM(ERR, "CDRMSyncobjProtocol: no nodes support explicit sync?");
+ LOGM(Log::ERR, "CDRMSyncobjProtocol: no nodes support explicit sync?");
return;
}
- LOGM(LOG, "CDRMSyncobjProtocol: using fd {}", m_drmFD);
+ LOGM(Log::DEBUG, "CDRMSyncobjProtocol: using fd {}", m_drmFD);
}
void CDRMSyncobjProtocol::bindManager(wl_client* client, void* data, uint32_t ver, uint32_t id) {
diff --git a/src/protocols/DataDeviceWlr.cpp b/src/protocols/DataDeviceWlr.cpp
index 835fbc01..d29106e0 100644
--- a/src/protocols/DataDeviceWlr.cpp
+++ b/src/protocols/DataDeviceWlr.cpp
@@ -14,16 +14,16 @@ CWLRDataOffer::CWLRDataOffer(SP<CZwlrDataControlOfferV1> resource_, SP<IDataSour
m_resource->setReceive([this](CZwlrDataControlOfferV1* r, const char* mime, int32_t 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());
m_source->send(mime, std::move(sendFd));
});
@@ -79,7 +79,7 @@ std::vector<std::string> CWLRDataSource::mimes() {
void CWLRDataSource::send(const std::string& mime, CFileDescriptor fd) {
if (std::ranges::find(m_mimeTypes, mime) == m_mimeTypes.end()) {
- LOGM(ERR, "Compositor/App bug: CWLRDataSource::sendAskSend with non-existent mime");
+ LOGM(Log::ERR, "Compositor/App bug: CWLRDataSource::sendAskSend with non-existent mime");
return;
}
@@ -88,7 +88,7 @@ void CWLRDataSource::send(const std::string& mime, CFileDescriptor fd) {
void CWLRDataSource::accepted(const std::string& mime) {
if (std::ranges::find(m_mimeTypes, mime) == m_mimeTypes.end())
- LOGM(ERR, "Compositor/App bug: CWLRDataSource::sendAccepted with non-existent mime");
+ LOGM(Log::ERR, "Compositor/App bug: CWLRDataSource::sendAccepted with non-existent mime");
// wlr has no accepted
}
@@ -113,34 +113,34 @@ CWLRDataDevice::CWLRDataDevice(SP<CZwlrDataControlDeviceV1> resource_) : m_resou
m_resource->setSetSelection([](CZwlrDataControlDeviceV1* r, wl_resource* sourceR) {
auto source = sourceR ? CWLRDataSource::fromResource(sourceR) : CSharedPointer<CWLRDataSource>{};
if (!source) {
- LOGM(LOG, "wlr reset selection received");
+ LOGM(Log::DEBUG, "wlr reset selection received");
g_pSeatManager->setCurrentSelection(nullptr);
return;
}
if (source && source->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();
- LOGM(LOG, "wlr manager requests selection to {:x}", (uintptr_t)source.get());
+ LOGM(Log::DEBUG, "wlr manager requests selection to {:x}", (uintptr_t)source.get());
g_pSeatManager->setCurrentSelection(source);
});
m_resource->setSetPrimarySelection([](CZwlrDataControlDeviceV1* r, wl_resource* sourceR) {
auto source = sourceR ? CWLRDataSource::fromResource(sourceR) : CSharedPointer<CWLRDataSource>{};
if (!source) {
- LOGM(LOG, "wlr reset primary selection received");
+ LOGM(Log::DEBUG, "wlr reset primary selection received");
g_pSeatManager->setCurrentPrimarySelection(nullptr);
return;
}
if (source && source->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();
- LOGM(LOG, "wlr manager requests primary selection to {:x}", (uintptr_t)source.get());
+ LOGM(Log::DEBUG, "wlr manager requests primary selection to {:x}", (uintptr_t)source.get());
g_pSeatManager->setCurrentPrimarySelection(source);
});
}
@@ -197,7 +197,7 @@ CWLRDataControlManagerResource::CWLRDataControlManagerResource(SP<CZwlrDataContr
RESOURCE->sendInitialSelections();
- LOGM(LOG, "New wlr data device bound at {:x}", (uintptr_t)RESOURCE.get());
+ LOGM(Log::DEBUG, "New wlr data device bound at {:x}", (uintptr_t)RESOURCE.get());
});
m_resource->setCreateDataSource([this](CZwlrDataControlManagerV1* r, uint32_t id) {
@@ -213,13 +213,13 @@ CWLRDataControlManagerResource::CWLRDataControlManagerResource(SP<CZwlrDataContr
}
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 wlr data source bound at {:x}", (uintptr_t)RESOURCE.get());
+ LOGM(Log::DEBUG, "New wlr data source bound at {:x}", (uintptr_t)RESOURCE.get());
});
}
@@ -240,7 +240,7 @@ void CDataDeviceWLRProtocol::bindManager(wl_client* client, void* data, uint32_t
return;
}
- LOGM(LOG, "New wlr_data_control_manager at {:x}", (uintptr_t)RESOURCE.get());
+ LOGM(Log::DEBUG, "New wlr_data_control_manager at {:x}", (uintptr_t)RESOURCE.get());
}
void CDataDeviceWLRProtocol::destroyResource(CWLRDataControlManagerResource* resource) {
@@ -278,7 +278,7 @@ void CDataDeviceWLRProtocol::sendSelectionToDevice(SP<CWLRDataDevice> dev, SP<ID
OFFER->m_primary = primary;
- LOGM(LOG, "New {}offer {:x} for data source {:x}", primary ? "primary " : " ", (uintptr_t)OFFER.get(), (uintptr_t)sel.get());
+ LOGM(Log::DEBUG, "New {}offer {:x} for data source {:x}", primary ? "primary " : " ", (uintptr_t)OFFER.get(), (uintptr_t)sel.get());
dev->sendDataOffer(OFFER);
OFFER->sendData();
@@ -298,7 +298,7 @@ void CDataDeviceWLRProtocol::setSelection(SP<IDataSource> source, bool primary)
}
if (!source) {
- LOGM(LOG, "resetting {}selection", primary ? "primary " : " ");
+ LOGM(Log::DEBUG, "resetting {}selection", primary ? "primary " : " ");
for (auto const& d : m_devices) {
sendSelectionToDevice(d, nullptr, primary);
@@ -307,7 +307,7 @@ void CDataDeviceWLRProtocol::setSelection(SP<IDataSource> source, bool primary)
return;
}
- LOGM(LOG, "New {}selection for data source {:x}", primary ? "primary" : "", (uintptr_t)source.get());
+ LOGM(Log::DEBUG, "New {}selection for data source {:x}", primary ? "primary" : "", (uintptr_t)source.get());
for (auto const& d : m_devices) {
sendSelectionToDevice(d, source, primary);
diff --git a/src/protocols/ExtDataDevice.cpp b/src/protocols/ExtDataDevice.cpp
index c2d4c497..6ab83ab4 100644
--- a/src/protocols/ExtDataDevice.cpp
+++ b/src/protocols/ExtDataDevice.cpp
@@ -14,16 +14,16 @@ CExtDataOffer::CExtDataOffer(SP<CExtDataControlOfferV1> resource_, SP<IDataSourc
m_resource->setReceive([this](CExtDataControlOfferV1* r, const char* mime, int32_t 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());
m_source->send(mime, std::move(sendFd));
});
@@ -79,7 +79,7 @@ std::vector<std::string> CExtDataSource::mimes() {
void CExtDataSource::send(const std::string& mime, CFileDescriptor fd) {
if (std::ranges::find(m_mimeTypes, mime) == m_mimeTypes.end()) {
- LOGM(ERR, "Compositor/App bug: CExtDataSource::sendAskSend with non-existent mime");
+ LOGM(Log::ERR, "Compositor/App bug: CExtDataSource::sendAskSend with non-existent mime");
return;
}
@@ -88,7 +88,7 @@ void CExtDataSource::send(const std::string& mime, CFileDescriptor fd) {
void CExtDataSource::accepted(const std::string& mime) {
if (std::ranges::find(m_mimeTypes, mime) == m_mimeTypes.end())
- LOGM(ERR, "Compositor/App bug: CExtDataSource::sendAccepted with non-existent mime");
+ LOGM(Log::ERR, "Compositor/App bug: CExtDataSource::sendAccepted with non-existent mime");
// ext has no accepted
}
@@ -113,34 +113,34 @@ CExtDataDevice::CExtDataDevice(SP<CExtDataControlDeviceV1> resource_) : m_resour
m_resource->setSetSelection([](CExtDataControlDeviceV1* r, wl_resource* sourceR) {
auto source = sourceR ? CExtDataSource::fromResource(sourceR) : CSharedPointer<CExtDataSource>{};
if (!source) {
- LOGM(LOG, "ext reset selection received");
+ LOGM(Log::DEBUG, "ext reset selection received");
g_pSeatManager->setCurrentSelection(nullptr);
return;
}
if (source && source->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();
- LOGM(LOG, "ext manager requests selection to {:x}", (uintptr_t)source.get());
+ LOGM(Log::DEBUG, "ext manager requests selection to {:x}", (uintptr_t)source.get());
g_pSeatManager->setCurrentSelection(source);
});
m_resource->setSetPrimarySelection([](CExtDataControlDeviceV1* r, wl_resource* sourceR) {
auto source = sourceR ? CExtDataSource::fromResource(sourceR) : CSharedPointer<CExtDataSource>{};
if (!source) {
- LOGM(LOG, "ext reset primary selection received");
+ LOGM(Log::DEBUG, "ext reset primary selection received");
g_pSeatManager->setCurrentPrimarySelection(nullptr);
return;
}
if (source && source->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();
- LOGM(LOG, "ext manager requests primary selection to {:x}", (uintptr_t)source.get());
+ LOGM(Log::DEBUG, "ext manager requests primary selection to {:x}", (uintptr_t)source.get());
g_pSeatManager->setCurrentPrimarySelection(source);
});
}
@@ -197,7 +197,7 @@ CExtDataControlManagerResource::CExtDataControlManagerResource(SP<CExtDataContro
RESOURCE->sendInitialSelections();
- LOGM(LOG, "New ext data device bound at {:x}", (uintptr_t)RESOURCE.get());
+ LOGM(Log::DEBUG, "New ext data device bound at {:x}", (uintptr_t)RESOURCE.get());
});
m_resource->setCreateDataSource([this](CExtDataControlManagerV1* r, uint32_t id) {
@@ -213,13 +213,13 @@ CExtDataControlManagerResource::CExtDataControlManagerResource(SP<CExtDataContro
}
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 ext data source bound at {:x}", (uintptr_t)RESOURCE.get());
+ LOGM(Log::DEBUG, "New ext data source bound at {:x}", (uintptr_t)RESOURCE.get());
});
}
@@ -240,7 +240,7 @@ void CExtDataDeviceProtocol::bindManager(wl_client* client, void* data, uint32_t
return;
}
- LOGM(LOG, "New ext_data_control_manager at {:x}", (uintptr_t)RESOURCE.get());
+ LOGM(Log::DEBUG, "New ext_data_control_manager at {:x}", (uintptr_t)RESOURCE.get());
}
void CExtDataDeviceProtocol::destroyResource(CExtDataControlManagerResource* resource) {
@@ -278,7 +278,7 @@ void CExtDataDeviceProtocol::sendSelectionToDevice(SP<CExtDataDevice> dev, SP<ID
OFFER->m_primary = primary;
- LOGM(LOG, "New {}offer {:x} for data source {:x}", primary ? "primary " : " ", (uintptr_t)OFFER.get(), (uintptr_t)sel.get());
+ LOGM(Log::DEBUG, "New {}offer {:x} for data source {:x}", primary ? "primary " : " ", (uintptr_t)OFFER.get(), (uintptr_t)sel.get());
dev->sendDataOffer(OFFER);
OFFER->sendData();
@@ -298,7 +298,7 @@ void CExtDataDeviceProtocol::setSelection(SP<IDataSource> source, bool primary)
}
if (!source) {
- LOGM(LOG, "resetting {}selection", primary ? "primary " : " ");
+ LOGM(Log::DEBUG, "resetting {}selection", primary ? "primary " : " ");
for (auto const& d : m_devices) {
sendSelectionToDevice(d, nullptr, primary);
@@ -307,7 +307,7 @@ void CExtDataDeviceProtocol::setSelection(SP<IDataSource> source, bool primary)
return;
}
- LOGM(LOG, "New {}selection for data source {:x}", primary ? "primary" : "", (uintptr_t)source.get());
+ LOGM(Log::DEBUG, "New {}selection for data source {:x}", primary ? "primary" : "", (uintptr_t)source.get());
for (auto const& d : m_devices) {
sendSelectionToDevice(d, source, primary);
diff --git a/src/protocols/ExtWorkspace.cpp b/src/protocols/ExtWorkspace.cpp
index bc4402f0..2af72a4d 100644
--- a/src/protocols/ExtWorkspace.cpp
+++ b/src/protocols/ExtWorkspace.cpp
@@ -273,7 +273,7 @@ void CExtWorkspaceManagerResource::onMonitorCreated(const PHLMONITOR& monitor) {
group->sendToWorkspaces();
if UNLIKELY (!group->good()) {
- LOGM(ERR, "Couldn't create a workspace group object");
+ LOGM(Log::ERR, "Couldn't create a workspace group object");
wl_client_post_no_memory(m_resource->client());
return;
}
@@ -287,7 +287,7 @@ void CExtWorkspaceManagerResource::onWorkspaceCreated(const PHLWORKSPACE& worksp
ws->m_self = ws;
if UNLIKELY (!ws->good()) {
- LOGM(ERR, "Couldn't create a workspace object");
+ LOGM(Log::ERR, "Couldn't create a workspace object");
wl_client_post_no_memory(m_resource->client());
return;
}
@@ -316,7 +316,7 @@ void CExtWorkspaceProtocol::bindManager(wl_client* client, void* data, uint32_t
manager->init(manager);
if UNLIKELY (!manager->good()) {
- LOGM(ERR, "Couldn't create a workspace manager");
+ LOGM(Log::ERR, "Couldn't create a workspace manager");
wl_client_post_no_memory(client);
return;
}
diff --git a/src/protocols/Fifo.cpp b/src/protocols/Fifo.cpp
index 63ce8579..d9f873c9 100644
--- a/src/protocols/Fifo.cpp
+++ b/src/protocols/Fifo.cpp
@@ -119,7 +119,7 @@ CFifoManagerResource::CFifoManagerResource(UP<CWpFifoManagerV1>&& resource_) : m
}
surf->m_fifo = RESOURCE;
- LOGM(LOG, "New fifo at {:x} for surface {:x}", (uintptr_t)RESOURCE, (uintptr_t)surf.get());
+ LOGM(Log::DEBUG, "New fifo at {:x} for surface {:x}", (uintptr_t)RESOURCE, (uintptr_t)surf.get());
});
}
diff --git a/src/protocols/FocusGrab.cpp b/src/protocols/FocusGrab.cpp
index b761d264..62b65655 100644
--- a/src/protocols/FocusGrab.cpp
+++ b/src/protocols/FocusGrab.cpp
@@ -107,7 +107,7 @@ void CFocusGrab::refocusKeyboard() {
if (surface)
Desktop::focusState()->rawSurfaceFocus(surface);
else
- LOGM(ERR, "CFocusGrab::refocusKeyboard called with no committed surfaces. This should never happen.");
+ LOGM(Log::ERR, "CFocusGrab::refocusKeyboard called with no committed surfaces. This should never happen.");
}
void CFocusGrab::commit(bool removeOnly) {
diff --git a/src/protocols/ForeignToplevel.cpp b/src/protocols/ForeignToplevel.cpp
index 22bef314..5515d2fb 100644
--- a/src/protocols/ForeignToplevel.cpp
+++ b/src/protocols/ForeignToplevel.cpp
@@ -30,7 +30,7 @@ CForeignToplevelList::CForeignToplevelList(SP<CExtForeignToplevelListV1> resourc
m_resource->setStop([this](CExtForeignToplevelListV1* h) {
m_resource->sendFinished();
m_finished = true;
- LOGM(LOG, "CForeignToplevelList: finished");
+ LOGM(Log::DEBUG, "CForeignToplevelList: finished");
});
for (auto const& w : g_pCompositor->m_windows) {
@@ -58,7 +58,7 @@ void CForeignToplevelList::onMap(PHLWINDOW pWindow) {
makeShared<CForeignToplevelHandle>(makeShared<CExtForeignToplevelHandleV1>(m_resource->client(), m_resource->version(), 0), pWindow));
if (!NEWHANDLE->good()) {
- LOGM(ERR, "Couldn't create a foreign handle");
+ LOGM(Log::ERR, "Couldn't create a foreign handle");
m_resource->noMemory();
PROTO::foreignToplevel->m_handles.pop_back();
return;
@@ -66,7 +66,7 @@ void CForeignToplevelList::onMap(PHLWINDOW pWindow) {
const auto IDENTIFIER = std::format("{:08x}->{:016x}", sc<uint32_t>(rc<uintptr_t>(this) & 0xFFFFFFFF), rc<uintptr_t>(pWindow.get()));
- LOGM(LOG, "Newly mapped window gets an identifier of {}", IDENTIFIER);
+ LOGM(Log::DEBUG, "Newly mapped window gets an identifier of {}", IDENTIFIER);
m_resource->sendToplevel(NEWHANDLE->m_resource.get());
NEWHANDLE->m_resource->sendIdentifier(IDENTIFIER.c_str());
NEWHANDLE->m_resource->sendAppId(pWindow->m_initialClass.c_str());
@@ -161,7 +161,7 @@ void CForeignToplevelProtocol::bindManager(wl_client* client, void* data, uint32
const auto RESOURCE = m_managers.emplace_back(makeUnique<CForeignToplevelList>(makeShared<CExtForeignToplevelListV1>(client, ver, id))).get();
if UNLIKELY (!RESOURCE->good()) {
- LOGM(ERR, "Couldn't create a foreign list");
+ LOGM(Log::ERR, "Couldn't create a foreign list");
wl_client_post_no_memory(client);
m_managers.pop_back();
return;
diff --git a/src/protocols/ForeignToplevelWlr.cpp b/src/protocols/ForeignToplevelWlr.cpp
index 46cd5f1b..5e18483d 100644
--- a/src/protocols/ForeignToplevelWlr.cpp
+++ b/src/protocols/ForeignToplevelWlr.cpp
@@ -206,7 +206,7 @@ CForeignToplevelWlrManager::CForeignToplevelWlrManager(SP<CZwlrForeignToplevelMa
m_resource->setStop([this](CZwlrForeignToplevelManagerV1* h) {
m_resource->sendFinished();
m_finished = true;
- LOGM(LOG, "CForeignToplevelWlrManager: finished");
+ LOGM(Log::DEBUG, "CForeignToplevelWlrManager: finished");
PROTO::foreignToplevelWlr->onManagerResourceDestroy(this);
});
@@ -228,13 +228,13 @@ void CForeignToplevelWlrManager::onMap(PHLWINDOW pWindow) {
makeShared<CForeignToplevelHandleWlr>(makeShared<CZwlrForeignToplevelHandleV1>(m_resource->client(), m_resource->version(), 0), pWindow));
if UNLIKELY (!NEWHANDLE->good()) {
- LOGM(ERR, "Couldn't create a foreign handle");
+ LOGM(Log::ERR, "Couldn't create a foreign handle");
m_resource->noMemory();
PROTO::foreignToplevelWlr->m_handles.pop_back();
return;
}
- LOGM(LOG, "Newly mapped window {:016x}", (uintptr_t)pWindow.get());
+ LOGM(Log::DEBUG, "Newly mapped window {:016x}", (uintptr_t)pWindow.get());
m_resource->sendToplevel(NEWHANDLE->m_resource.get());
NEWHANDLE->m_resource->sendAppId(pWindow->m_class.c_str());
NEWHANDLE->m_resource->sendTitle(pWindow->m_title.c_str());
@@ -409,7 +409,7 @@ void CForeignToplevelWlrProtocol::bindManager(wl_client* client, void* data, uin
const auto RESOURCE = m_managers.emplace_back(makeUnique<CForeignToplevelWlrManager>(makeShared<CZwlrForeignToplevelManagerV1>(client, ver, id))).get();
if UNLIKELY (!RESOURCE->good()) {
- LOGM(ERR, "Couldn't create a foreign list");
+ LOGM(Log::ERR, "Couldn't create a foreign list");
wl_client_post_no_memory(client);
m_managers.pop_back();
return;
diff --git a/src/protocols/FractionalScale.cpp b/src/protocols/FractionalScale.cpp
index 899d1390..9bdf5910 100644
--- a/src/protocols/FractionalScale.cpp
+++ b/src/protocols/FractionalScale.cpp
@@ -26,7 +26,7 @@ void CFractionalScaleProtocol::onManagerResourceDestroy(wl_resource* res) {
void CFractionalScaleProtocol::onGetFractionalScale(CWpFractionalScaleManagerV1* pMgr, uint32_t id, SP<CWLSurfaceResource> surface) {
for (auto const& [k, v] : m_addons) {
if (k == surface) {
- LOGM(ERR, "Surface {:x} already has a fractionalScale addon", (uintptr_t)surface.get());
+ LOGM(Log::ERR, "Surface {:x} already has a fractionalScale addon", (uintptr_t)surface.get());
pMgr->error(WP_FRACTIONAL_SCALE_MANAGER_V1_ERROR_FRACTIONAL_SCALE_EXISTS, "Fractional scale already exists");
return;
}
diff --git a/src/protocols/FrogColorManagement.cpp b/src/protocols/FrogColorManagement.cpp
index 730a15b0..8506ce7b 100644
--- a/src/protocols/FrogColorManagement.cpp
+++ b/src/protocols/FrogColorManagement.cpp
@@ -26,15 +26,15 @@ CFrogColorManager::CFrogColorManager(SP<CFrogColorManagementFactoryV1> resource_
if UNLIKELY (!good())
return;
- m_resource->setDestroy([](CFrogColorManagementFactoryV1* r) { LOGM(TRACE, "Destroy frog_color_management at {:x} (generated default)", (uintptr_t)r); });
+ m_resource->setDestroy([](CFrogColorManagementFactoryV1* r) { LOGM(Log::TRACE, "Destroy frog_color_management at {:x} (generated default)", (uintptr_t)r); });
m_resource->setOnDestroy([this](CFrogColorManagementFactoryV1* r) { PROTO::frogColorManagement->destroyResource(this); });
m_resource->setGetColorManagedSurface([](CFrogColorManagementFactoryV1* r, wl_resource* surface, uint32_t id) {
- LOGM(TRACE, "Get surface for id={}, surface={}", id, (uintptr_t)surface);
+ LOGM(Log::TRACE, "Get surface for id={}, surface={}", id, (uintptr_t)surface);
auto SURF = CWLSurfaceResource::fromResource(surface);
if (!SURF) {
- LOGM(ERR, "No surface for resource {}", (uintptr_t)surface);
+ LOGM(Log::ERR, "No surface for resource {}", (uintptr_t)surface);
r->error(-1, "Invalid surface (2)");
return;
}
@@ -74,24 +74,24 @@ CFrogColorManagementSurface::CFrogColorManagementSurface(SP<CFrogColorManagedSur
m_surface->m_colorManagement = RESOURCE;
m_resource->setOnDestroy([this](CFrogColorManagedSurface* r) {
- LOGM(TRACE, "Destroy frog cm and xx cm for surface {}", (uintptr_t)m_surface);
+ LOGM(Log::TRACE, "Destroy frog cm and xx cm for surface {}", (uintptr_t)m_surface);
if (m_surface.valid())
PROTO::colorManagement->destroyResource(m_surface->m_colorManagement.get());
PROTO::frogColorManagement->destroyResource(this);
});
} else
m_resource->setOnDestroy([this](CFrogColorManagedSurface* r) {
- LOGM(TRACE, "Destroy frog cm surface {}", (uintptr_t)m_surface);
+ LOGM(Log::TRACE, "Destroy frog cm surface {}", (uintptr_t)m_surface);
PROTO::frogColorManagement->destroyResource(this);
});
m_resource->setDestroy([this](CFrogColorManagedSurface* r) {
- LOGM(TRACE, "Destroy frog cm surface {}", (uintptr_t)m_surface);
+ LOGM(Log::TRACE, "Destroy frog cm surface {}", (uintptr_t)m_surface);
PROTO::frogColorManagement->destroyResource(this);
});
m_resource->setSetKnownTransferFunction([this](CFrogColorManagedSurface* r, frogColorManagedSurfaceTransferFunction tf) {
- LOGM(TRACE, "Set frog cm transfer function {} for {}", (uint32_t)tf, m_surface->id());
+ LOGM(Log::TRACE, "Set frog cm transfer function {} for {}", (uint32_t)tf, m_surface->id());
switch (tf) {
case FROG_COLOR_MANAGED_SURFACE_TRANSFER_FUNCTION_ST2084_PQ:
m_surface->m_colorManagement->m_imageDescription.transferFunction =
@@ -100,7 +100,7 @@ CFrogColorManagementSurface::CFrogColorManagementSurface(SP<CFrogColorManagedSur
;
case FROG_COLOR_MANAGED_SURFACE_TRANSFER_FUNCTION_GAMMA_22:
if (m_pqIntentSent) {
- LOGM(TRACE,
+ LOGM(Log::TRACE,
"FIXME: assuming broken enum value 2 (FROG_COLOR_MANAGED_SURFACE_TRANSFER_FUNCTION_GAMMA_22) referring to eotf value 2 (TRANSFER_FUNCTION_ST2084_PQ)");
m_surface->m_colorManagement->m_imageDescription.transferFunction =
convertTransferFunction(getWPTransferFunction(FROG_COLOR_MANAGED_SURFACE_TRANSFER_FUNCTION_ST2084_PQ));
@@ -108,7 +108,7 @@ CFrogColorManagementSurface::CFrogColorManagementSurface(SP<CFrogColorManagedSur
};
[[fallthrough]];
case FROG_COLOR_MANAGED_SURFACE_TRANSFER_FUNCTION_UNDEFINED:
- case FROG_COLOR_MANAGED_SURFACE_TRANSFER_FUNCTION_SCRGB_LINEAR: LOGM(TRACE, "FIXME: add tf support for {}", (uint32_t)tf); [[fallthrough]];
+ case FROG_COLOR_MANAGED_SURFACE_TRANSFER_FUNCTION_SCRGB_LINEAR: LOGM(Log::TRACE, "FIXME: add tf support for {}", (uint32_t)tf); [[fallthrough]];
case FROG_COLOR_MANAGED_SURFACE_TRANSFER_FUNCTION_SRGB:
m_surface->m_colorManagement->m_imageDescription.transferFunction = convertTransferFunction(getWPTransferFunction(tf));
@@ -116,7 +116,7 @@ CFrogColorManagementSurface::CFrogColorManagementSurface(SP<CFrogColorManagedSur
}
});
m_resource->setSetKnownContainerColorVolume([this](CFrogColorManagedSurface* r, frogColorManagedSurfacePrimaries primariesName) {
- LOGM(TRACE, "Set frog cm primaries {}", (uint32_t)primariesName);
+ LOGM(Log::TRACE, "Set frog cm primaries {}", (uint32_t)primariesName);
switch (primariesName) {
case FROG_COLOR_MANAGED_SURFACE_PRIMARIES_UNDEFINED:
case FROG_COLOR_MANAGED_SURFACE_PRIMARIES_REC709: m_surface->m_colorManagement->m_imageDescription.primaries = NColorPrimaries::BT709; break;
@@ -127,13 +127,14 @@ CFrogColorManagementSurface::CFrogColorManagementSurface(SP<CFrogColorManagedSur
m_surface->m_colorManagement->setHasImageDescription(true);
});
m_resource->setSetRenderIntent([this](CFrogColorManagedSurface* r, frogColorManagedSurfaceRenderIntent intent) {
- LOGM(TRACE, "Set frog cm intent {}", (uint32_t)intent);
+ LOGM(Log::TRACE, "Set frog cm intent {}", (uint32_t)intent);
m_pqIntentSent = intent == FROG_COLOR_MANAGED_SURFACE_RENDER_INTENT_PERCEPTUAL;
m_surface->m_colorManagement->setHasImageDescription(true);
});
m_resource->setSetHdrMetadata([this](CFrogColorManagedSurface* r, uint32_t r_x, uint32_t r_y, uint32_t g_x, uint32_t g_y, uint32_t b_x, uint32_t b_y, uint32_t w_x,
uint32_t w_y, uint32_t max_lum, uint32_t min_lum, uint32_t cll, uint32_t fall) {
- LOGM(TRACE, "Set frog primaries r:{},{} g:{},{} b:{},{} w:{},{} luminances {} - {} cll {} fall {}", r_x, r_y, g_x, g_y, b_x, b_y, w_x, w_y, min_lum, max_lum, cll, fall);
+ LOGM(Log::TRACE, "Set frog primaries r:{},{} g:{},{} b:{},{} w:{},{} luminances {} - {} cll {} fall {}", r_x, r_y, g_x, g_y, b_x, b_y, w_x, w_y, min_lum, max_lum, cll,
+ fall);
m_surface->m_colorManagement->m_imageDescription.masteringPrimaries = SPCPRimaries{.red = {.x = r_x / 50000.0f, .y = r_y / 50000.0f},
.green = {.x = g_x / 50000.0f, .y = g_y / 50000.0f},
.blue = {.x = b_x / 50000.0f, .y = b_y / 50000.0f},
@@ -168,7 +169,7 @@ void CFrogColorManagementProtocol::bindManager(wl_client* client, void* data, ui
return;
}
- LOGM(TRACE, "New frog_color_management at {:x}", (uintptr_t)RESOURCE.get());
+ LOGM(Log::TRACE, "New frog_color_management at {:x}", (uintptr_t)RESOURCE.get());
}
void CFrogColorManagementProtocol::destroyResource(CFrogColorManager* resource) {
diff --git a/src/protocols/GammaControl.cpp b/src/protocols/GammaControl.cpp
index 58382de9..2517c754 100644
--- a/src/protocols/GammaControl.cpp
+++ b/src/protocols/GammaControl.cpp
@@ -13,7 +13,7 @@ CGammaControl::CGammaControl(SP<CZwlrGammaControlV1> resource_, wl_resource* out
auto OUTPUTRES = CWLOutputResource::fromResource(output);
if UNLIKELY (!OUTPUTRES) {
- LOGM(ERR, "No output in CGammaControl");
+ LOGM(Log::ERR, "No output in CGammaControl");
m_resource->sendFailed();
return;
}
@@ -21,7 +21,7 @@ CGammaControl::CGammaControl(SP<CZwlrGammaControlV1> resource_, wl_resource* out
m_monitor = OUTPUTRES->m_monitor;
if UNLIKELY (!m_monitor || !m_monitor->m_output) {
- LOGM(ERR, "No CMonitor");
+ LOGM(Log::ERR, "No CMonitor");
m_resource->sendFailed();
return;
}
@@ -36,7 +36,7 @@ CGammaControl::CGammaControl(SP<CZwlrGammaControlV1> resource_, wl_resource* out
m_gammaSize = m_monitor->m_output->getGammaSize();
if UNLIKELY (m_gammaSize <= 0) {
- LOGM(ERR, "Output {} doesn't support gamma", m_monitor->m_name);
+ LOGM(Log::ERR, "Output {} doesn't support gamma", m_monitor->m_name);
m_resource->sendFailed();
return;
}
@@ -49,24 +49,24 @@ CGammaControl::CGammaControl(SP<CZwlrGammaControlV1> resource_, wl_resource* out
m_resource->setSetGamma([this](CZwlrGammaControlV1* gamma, int32_t fd) {
CFileDescriptor gammaFd{fd};
if UNLIKELY (!m_monitor) {
- LOGM(ERR, "setGamma for a dead monitor");
+ LOGM(Log::ERR, "setGamma for a dead monitor");
m_resource->sendFailed();
return;
}
- LOGM(LOG, "setGamma for {}", m_monitor->m_name);
+ LOGM(Log::DEBUG, "setGamma for {}", m_monitor->m_name);
// TODO: make CFileDescriptor getflags use F_GETFL
int fdFlags = fcntl(gammaFd.get(), F_GETFL, 0);
if UNLIKELY (fdFlags < 0) {
- LOGM(ERR, "Failed to get fd flags");
+ LOGM(Log::ERR, "Failed to get fd flags");
m_resource->sendFailed();
return;
}
// TODO: make CFileDescriptor setflags use F_SETFL
if UNLIKELY (fcntl(gammaFd.get(), F_SETFL, fdFlags | O_NONBLOCK) < 0) {
- LOGM(ERR, "Failed to set fd flags");
+ LOGM(Log::ERR, "Failed to set fd flags");
m_resource->sendFailed();
return;
}
@@ -81,7 +81,7 @@ CGammaControl::CGammaControl(SP<CZwlrGammaControlV1> resource_, wl_resource* out
}
if (readBytes < 0 || sc<size_t>(readBytes) != m_gammaTable.size() * sizeof(uint16_t) || moreBytes != 0) {
- LOGM(ERR, "Failed to read bytes");
+ LOGM(Log::ERR, "Failed to read bytes");
if (sc<size_t>(readBytes) != m_gammaTable.size() * sizeof(uint16_t) || moreBytes > 0) {
gamma->error(ZWLR_GAMMA_CONTROL_V1_ERROR_INVALID_GAMMA, "Gamma ramps size mismatch");
@@ -136,7 +136,7 @@ void CGammaControl::applyToMonitor() {
if UNLIKELY (!m_monitor || !m_monitor->m_output)
return; // ??
- LOGM(LOG, "setting to monitor {}", m_monitor->m_name);
+ LOGM(Log::DEBUG, "setting to monitor {}", m_monitor->m_name);
if (!m_gammaTableSet) {
m_monitor->m_output->state->setGammaLut({});
@@ -146,7 +146,7 @@ void CGammaControl::applyToMonitor() {
m_monitor->m_output->state->setGammaLut(m_gammaTable);
if (!m_monitor->m_state.test()) {
- LOGM(LOG, "setting to monitor {} failed", m_monitor->m_name);
+ LOGM(Log::DEBUG, "setting to monitor {} failed", m_monitor->m_name);
m_monitor->m_output->state->setGammaLut({});
}
@@ -158,7 +158,7 @@ PHLMONITOR CGammaControl::getMonitor() {
}
void CGammaControl::onMonitorDestroy() {
- LOGM(LOG, "Destroying gamma control for {}", m_monitor->m_name);
+ LOGM(Log::DEBUG, "Destroying gamma control for {}", m_monitor->m_name);
m_resource->sendFailed();
}
diff --git a/src/protocols/HyprlandSurface.cpp b/src/protocols/HyprlandSurface.cpp
index 38b9c9f8..5d882206 100644
--- a/src/protocols/HyprlandSurface.cpp
+++ b/src/protocols/HyprlandSurface.cpp
@@ -113,7 +113,7 @@ void CHyprlandSurfaceProtocol::getSurface(CHyprlandSurfaceManagerV1* manager, ui
if (iter != m_surfaces.end()) {
if (iter->second->m_resource) {
- LOGM(ERR, "HyprlandSurface already present for surface {:x}", (uintptr_t)surface.get());
+ LOGM(Log::ERR, "HyprlandSurface already present for surface {:x}", (uintptr_t)surface.get());
manager->error(HYPRLAND_SURFACE_MANAGER_V1_ERROR_ALREADY_CONSTRUCTED, "HyprlandSurface already present");
return;
} else {
diff --git a/src/protocols/IdleNotify.cpp b/src/protocols/IdleNotify.cpp
index 4122bf24..b80bf5c6 100644
--- a/src/protocols/IdleNotify.cpp
+++ b/src/protocols/IdleNotify.cpp
@@ -23,7 +23,7 @@ CExtIdleNotification::CExtIdleNotification(SP<CExtIdleNotificationV1> resource_,
update();
- LOGM(LOG, "Registered idle-notification for {}ms", timeoutMs_);
+ LOGM(Log::DEBUG, "Registered idle-notification for {}ms", timeoutMs_);
}
CExtIdleNotification::~CExtIdleNotification() {
diff --git a/src/protocols/InputMethodV2.cpp b/src/protocols/InputMethodV2.cpp
index eaf7f141..0917d100 100644
--- a/src/protocols/InputMethodV2.cpp
+++ b/src/protocols/InputMethodV2.cpp
@@ -15,7 +15,7 @@ CInputMethodKeyboardGrabV2::CInputMethodKeyboardGrabV2(SP<CZwpInputMethodKeyboar
m_resource->setOnDestroy([this](CZwpInputMethodKeyboardGrabV2* r) { PROTO::ime->destroyResource(this); });
if (!g_pSeatManager->m_keyboard) {
- LOGM(ERR, "IME called but no active keyboard???");
+ LOGM(Log::ERR, "IME called but no active keyboard???");
return;
}
@@ -36,13 +36,13 @@ void CInputMethodKeyboardGrabV2::sendKeyboardData(SP<IKeyboard> keyboard) {
auto keymapFD = allocateSHMFile(keyboard->m_xkbKeymapV1String.length() + 1);
if UNLIKELY (!keymapFD.isValid()) {
- LOGM(ERR, "Failed to create a keymap file for keyboard grab");
+ LOGM(Log::ERR, "Failed to create a keymap file for keyboard grab");
return;
}
void* data = mmap(nullptr, keyboard->m_xkbKeymapV1String.length() + 1, PROT_READ | PROT_WRITE, MAP_SHARED, keymapFD.get(), 0);
if UNLIKELY (data == MAP_FAILED) {
- LOGM(ERR, "Failed to mmap a keymap file for keyboard grab");
+ LOGM(Log::ERR, "Failed to mmap a keymap file for keyboard grab");
return;
}
@@ -194,7 +194,7 @@ CInputMethodV2::CInputMethodV2(SP<CZwpInputMethodV2> resource_) : m_resource(res
return;
}
- LOGM(LOG, "New IME Popup with resource id {}", id);
+ LOGM(Log::DEBUG, "New IME Popup with resource id {}", id);
m_popups.emplace_back(RESOURCE);
@@ -211,7 +211,7 @@ CInputMethodV2::CInputMethodV2(SP<CZwpInputMethodV2> resource_) : m_resource(res
return;
}
- LOGM(LOG, "New IME Grab with resource id {}", id);
+ LOGM(Log::DEBUG, "New IME Grab with resource id {}", id);
m_grabs.emplace_back(RESOURCE);
});
@@ -367,7 +367,7 @@ void CInputMethodV2Protocol::onGetIME(CZwpInputMethodManagerV2* mgr, wl_resource
RESOURCE->m_self = RESOURCE;
- LOGM(LOG, "New IME with resource id {}", id);
+ LOGM(Log::DEBUG, "New IME with resource id {}", id);
m_events.newIME.emit(RESOURCE);
}
diff --git a/src/protocols/LayerShell.cpp b/src/protocols/LayerShell.cpp
index 32e91598..80222627 100644
--- a/src/protocols/LayerShell.cpp
+++ b/src/protocols/LayerShell.cpp
@@ -249,7 +249,7 @@ void CLayerShellProtocol::onGetLayerSurface(CZwlrLayerShellV1* pMgr, uint32_t id
SURF->m_role = makeShared<CLayerShellRole>(RESOURCE);
g_pCompositor->m_layers.emplace_back(Desktop::View::CLayerSurface::create(RESOURCE));
- LOGM(LOG, "New wlr_layer_surface {:x}", (uintptr_t)RESOURCE.get());
+ LOGM(Log::DEBUG, "New wlr_layer_surface {:x}", (uintptr_t)RESOURCE.get());
}
CLayerShellRole::CLayerShellRole(SP<CLayerShellResource> ls) : m_layerSurface(ls) {
diff --git a/src/protocols/LinuxDMABUF.cpp b/src/protocols/LinuxDMABUF.cpp
index a95a7a52..4f59e4b3 100644
--- a/src/protocols/LinuxDMABUF.cpp
+++ b/src/protocols/LinuxDMABUF.cpp
@@ -83,7 +83,7 @@ CDMABUFFormatTable::CDMABUFFormatTable(SDMABUFTranche _rendererTranche, std::vec
auto arr = sc<SDMABUFFormatTableEntry*>(mmap(nullptr, m_tableSize, PROT_READ | PROT_WRITE, MAP_SHARED, fds[0].get(), 0));
if (arr == MAP_FAILED) {
- LOGM(ERR, "mmap failed");
+ LOGM(Log::ERR, "mmap failed");
return;
}
@@ -105,7 +105,7 @@ CLinuxDMABuffer::CLinuxDMABuffer(uint32_t id, wl_client* client, Aquamarine::SDM
});
if (!m_buffer->m_success)
- LOGM(ERR, "Possibly compositor bug: buffer failed to create");
+ LOGM(Log::ERR, "Possibly compositor bug: buffer failed to create");
}
CLinuxDMABuffer::~CLinuxDMABuffer() {
@@ -161,7 +161,7 @@ CLinuxDMABUFParamsResource::CLinuxDMABUFParamsResource(UP<CZwpLinuxBufferParamsV
if (flags > 0) {
r->sendFailed();
- LOGM(ERR, "DMABUF flags are not supported");
+ LOGM(Log::ERR, "DMABUF flags are not supported");
return;
}
@@ -180,7 +180,7 @@ CLinuxDMABUFParamsResource::CLinuxDMABUFParamsResource(UP<CZwpLinuxBufferParamsV
if (flags > 0) {
r->sendFailed();
- LOGM(ERR, "DMABUF flags are not supported");
+ LOGM(Log::ERR, "DMABUF flags are not supported");
return;
}
@@ -200,19 +200,19 @@ void CLinuxDMABUFParamsResource::create(uint32_t id) {
m_used = true;
if UNLIKELY (!verify()) {
- LOGM(ERR, "Failed creating a dmabuf: verify() said no");
+ LOGM(Log::ERR, "Failed creating a dmabuf: verify() said no");
return; // if verify failed, we errored the resource.
}
if UNLIKELY (!commence()) {
- LOGM(ERR, "Failed creating a dmabuf: commence() said no");
+ LOGM(Log::ERR, "Failed creating a dmabuf: commence() said no");
m_resource->sendFailed();
return;
}
- LOGM(LOG, "Creating a dmabuf, with id {}: size {}, fmt {}, planes {}", id, m_attrs->size, NFormatUtils::drmFormatName(m_attrs->format), m_attrs->planes);
+ LOGM(Log::DEBUG, "Creating a dmabuf, with id {}: size {}, fmt {}, planes {}", id, m_attrs->size, NFormatUtils::drmFormatName(m_attrs->format), m_attrs->planes);
for (int i = 0; i < m_attrs->planes; ++i) {
- LOGM(LOG, " | plane {}: mod {} fd {} stride {} offset {}", i, m_attrs->modifier, m_attrs->fds[i], m_attrs->strides[i], m_attrs->offsets[i]);
+ LOGM(Log::DEBUG, " | plane {}: mod {} fd {} stride {} offset {}", i, m_attrs->modifier, m_attrs->fds[i], m_attrs->strides[i], m_attrs->offsets[i]);
}
auto& buf = PROTO::linuxDma->m_buffers.emplace_back(makeUnique<CLinuxDMABuffer>(id, m_resource->client(), *m_attrs));
@@ -237,12 +237,12 @@ bool CLinuxDMABUFParamsResource::commence() {
uint32_t handle = 0;
if (drmPrimeFDToHandle(PROTO::linuxDma->m_mainDeviceFD.get(), m_attrs->fds.at(i), &handle)) {
- LOGM(ERR, "Failed to import dmabuf fd");
+ LOGM(Log::ERR, "Failed to import dmabuf fd");
return false;
}
if (drmCloseBufferHandle(PROTO::linuxDma->m_mainDeviceFD.get(), handle)) {
- LOGM(ERR, "Failed to close dmabuf handle");
+ LOGM(Log::ERR, "Failed to close dmabuf handle");
return false;
}
}
@@ -412,7 +412,7 @@ CLinuxDMABufV1Protocol::CLinuxDMABufV1Protocol(const wl_interface* iface, const
auto dev = devIDFromFD(rendererFD);
if (!dev.has_value()) {
- LOGM(ERR, "failed to get drm dev, disabling linux dmabuf");
+ LOGM(Log::ERR, "failed to get drm dev, disabling linux dmabuf");
removeGlobal();
return;
}
@@ -462,7 +462,7 @@ CLinuxDMABufV1Protocol::CLinuxDMABufV1Protocol(const wl_interface* iface, const
drmDevice* device = nullptr;
if (drmGetDeviceFromDevId(m_mainDevice, 0, &device) != 0) {
- LOGM(ERR, "failed to get drm dev, disabling linux dmabuf");
+ LOGM(Log::ERR, "failed to get drm dev, disabling linux dmabuf");
removeGlobal();
return;
}
@@ -472,7 +472,7 @@ CLinuxDMABufV1Protocol::CLinuxDMABufV1Protocol(const wl_interface* iface, const
m_mainDeviceFD = CFileDescriptor{fcntl(g_pCompositor->m_drmRenderNode.fd, F_DUPFD_CLOEXEC, 0)};
drmFreeDevice(&device);
if (!m_mainDeviceFD.isValid()) {
- LOGM(ERR, "failed to open rendernode, disabling linux dmabuf");
+ LOGM(Log::ERR, "failed to open rendernode, disabling linux dmabuf");
removeGlobal();
return;
}
@@ -485,12 +485,12 @@ CLinuxDMABufV1Protocol::CLinuxDMABufV1Protocol(const wl_interface* iface, const
m_mainDeviceFD = CFileDescriptor{open(name, O_RDWR | O_CLOEXEC)};
drmFreeDevice(&device);
if (!m_mainDeviceFD.isValid()) {
- LOGM(ERR, "failed to open drm dev, disabling linux dmabuf");
+ LOGM(Log::ERR, "failed to open drm dev, disabling linux dmabuf");
removeGlobal();
return;
}
} else {
- LOGM(ERR, "DRM device {} has no render node, disabling linux dmabuf checks", device->nodes[DRM_NODE_PRIMARY] ? device->nodes[DRM_NODE_PRIMARY] : "null");
+ LOGM(Log::ERR, "DRM device {} has no render node, disabling linux dmabuf checks", device->nodes[DRM_NODE_PRIMARY] ? device->nodes[DRM_NODE_PRIMARY] : "null");
drmFreeDevice(&device);
}
});
@@ -500,7 +500,7 @@ void CLinuxDMABufV1Protocol::resetFormatTable() {
if (!m_formatTable)
return;
- LOGM(LOG, "Resetting format table");
+ LOGM(Log::DEBUG, "Resetting format table");
// this might be a big copy
auto newFormatTable = makeUnique<CDMABUFFormatTable>(m_formatTable->m_rendererTranche, m_formatTable->m_monitorTranches);
@@ -570,12 +570,12 @@ void CLinuxDMABufV1Protocol::updateScanoutTranche(SP<CWLSurfaceResource> surface
}
if (!feedbackResource) {
- LOGM(LOG, "updateScanoutTranche: surface has no dmabuf_feedback");
+ LOGM(Log::DEBUG, "updateScanoutTranche: surface has no dmabuf_feedback");
return;
}
if (!pMonitor) {
- LOGM(LOG, "updateScanoutTranche: resetting feedback");
+ LOGM(Log::DEBUG, "updateScanoutTranche: resetting feedback");
feedbackResource->sendDefaultFeedback();
return;
}
@@ -584,13 +584,13 @@ void CLinuxDMABufV1Protocol::updateScanoutTranche(SP<CWLSurfaceResource> surface
std::ranges::find_if(m_formatTable->m_monitorTranches, [pMonitor](std::pair<PHLMONITORREF, SDMABUFTranche> pair) { return pair.first == pMonitor; });
if (monitorTranchePair == m_formatTable->m_monitorTranches.end()) {
- LOGM(LOG, "updateScanoutTranche: monitor has no tranche");
+ LOGM(Log::DEBUG, "updateScanoutTranche: monitor has no tranche");
return;
}
auto& monitorTranche = (*monitorTranchePair).second;
- LOGM(LOG, "updateScanoutTranche: sending a scanout tranche");
+ LOGM(Log::DEBUG, "updateScanoutTranche: sending a scanout tranche");
struct wl_array deviceArr = {
.size = sizeof(m_mainDevice),
diff --git a/src/protocols/LockNotify.cpp b/src/protocols/LockNotify.cpp
index 1855f891..46736ead 100644
--- a/src/protocols/LockNotify.cpp
+++ b/src/protocols/LockNotify.cpp
@@ -63,7 +63,7 @@ void CLockNotifyProtocol::onGetNotification(CHyprlandLockNotifierV1* pMgr, uint3
void CLockNotifyProtocol::onLocked() {
if UNLIKELY (m_isLocked) {
- LOGM(ERR, "Not sending lock notification. Already locked!");
+ LOGM(Log::ERR, "Not sending lock notification. Already locked!");
return;
}
@@ -76,7 +76,7 @@ void CLockNotifyProtocol::onLocked() {
void CLockNotifyProtocol::onUnlocked() {
if UNLIKELY (!m_isLocked) {
- LOGM(ERR, "Not sending unlock notification. Not locked!");
+ LOGM(Log::ERR, "Not sending unlock notification. Not locked!");
return;
}
diff --git a/src/protocols/MesaDRM.cpp b/src/protocols/MesaDRM.cpp
index 789f90b6..8a0b08b7 100644
--- a/src/protocols/MesaDRM.cpp
+++ b/src/protocols/MesaDRM.cpp
@@ -6,9 +6,9 @@
#include "../render/OpenGL.hpp"
CMesaDRMBufferResource::CMesaDRMBufferResource(uint32_t id, wl_client* client, Aquamarine::SDMABUFAttrs attrs_) {
- LOGM(LOG, "Creating a Mesa dmabuf, with id {}: size {}, fmt {}, planes {}", id, attrs_.size, attrs_.format, attrs_.planes);
+ LOGM(Log::DEBUG, "Creating a Mesa dmabuf, with id {}: size {}, fmt {}, planes {}", id, attrs_.size, attrs_.format, attrs_.planes);
for (int i = 0; i < attrs_.planes; ++i) {
- LOGM(LOG, " | plane {}: mod {} fd {} stride {} offset {}", i, attrs_.modifier, attrs_.fds[i], attrs_.strides[i], attrs_.offsets[i]);
+ LOGM(Log::DEBUG, " | plane {}: mod {} fd {} stride {} offset {}", i, attrs_.modifier, attrs_.fds[i], attrs_.strides[i], attrs_.offsets[i]);
}
m_buffer = makeShared<CDMABuffer>(id, client, attrs_);
@@ -20,7 +20,7 @@ CMesaDRMBufferResource::CMesaDRMBufferResource(uint32_t id, wl_client* client, A
});
if (!m_buffer->m_success)
- LOGM(ERR, "Possibly compositor bug: buffer failed to create");
+ LOGM(Log::ERR, "Possibly compositor bug: buffer failed to create");
}
CMesaDRMBufferResource::~CMesaDRMBufferResource() {
@@ -116,7 +116,7 @@ CMesaDRMProtocol::CMesaDRMProtocol(const wl_interface* iface, const int& ver, co
int drmFD = g_pCompositor->m_drmRenderNode.fd >= 0 ? g_pCompositor->m_drmRenderNode.fd : g_pCompositor->m_drm.fd;
if (drmGetDevice2(drmFD, 0, &dev) != 0) {
- LOGM(ERR, "Failed to get device from fd {}, disabling MesaDRM", drmFD);
+ LOGM(Log::ERR, "Failed to get device from fd {}, disabling MesaDRM", drmFD);
removeGlobal();
return;
}
@@ -124,10 +124,10 @@ CMesaDRMProtocol::CMesaDRMProtocol(const wl_interface* iface, const int& ver, co
if (dev->available_nodes & (1 << DRM_NODE_RENDER) && dev->nodes[DRM_NODE_RENDER]) {
m_nodeName = dev->nodes[DRM_NODE_RENDER];
} else if (dev->available_nodes & (1 << DRM_NODE_PRIMARY) && dev->nodes[DRM_NODE_PRIMARY]) {
- LOGM(WARN, "No DRM render node, falling back to primary {}", dev->nodes[DRM_NODE_PRIMARY]);
+ LOGM(Log::WARN, "No DRM render node, falling back to primary {}", dev->nodes[DRM_NODE_PRIMARY]);
m_nodeName = dev->nodes[DRM_NODE_PRIMARY];
} else {
- LOGM(ERR, "No usable DRM node (render or primary) found, disabling MesaDRM");
+ LOGM(Log::ERR, "No usable DRM node (render or primary) found, disabling MesaDRM");
drmFreeDevice(&dev);
removeGlobal();
return;
diff --git a/src/protocols/OutputManagement.cpp b/src/protocols/OutputManagement.cpp
index 6ae7c820..57d39371 100644
--- a/src/protocols/OutputManagement.cpp
+++ b/src/protocols/OutputManagement.cpp
@@ -11,14 +11,14 @@ COutputManager::COutputManager(SP<CZwlrOutputManagerV1> resource_) : m_resource(
if UNLIKELY (!good())
return;
- LOGM(LOG, "New OutputManager registered");
+ LOGM(Log::DEBUG, "New OutputManager registered");
m_resource->setOnDestroy([this](CZwlrOutputManagerV1* r) { PROTO::outputManagement->destroyResource(this); });
m_resource->setStop([this](CZwlrOutputManagerV1* r) { m_stopped = true; });
m_resource->setCreateConfiguration([this](CZwlrOutputManagerV1* r, uint32_t id, uint32_t serial) {
- LOGM(LOG, "Creating new configuration");
+ LOGM(Log::DEBUG, "Creating new configuration");
const auto RESOURCE = PROTO::outputManagement->m_configurations.emplace_back(
makeShared<COutputConfiguration>(makeShared<CZwlrOutputConfigurationV1>(m_resource->client(), m_resource->version(), id), m_self.lock()));
@@ -37,7 +37,7 @@ COutputManager::COutputManager(SP<CZwlrOutputManagerV1> resource_) : m_resource(
if (m == g_pCompositor->m_unsafeOutput)
continue;
- LOGM(LOG, " | sending output head for {}", m->m_name);
+ LOGM(Log::DEBUG, " | sending output head for {}", m->m_name);
makeAndSendNewHead(m);
}
@@ -171,9 +171,9 @@ void COutputHead::sendAllData() {
if (m->m_mode == m_monitor->m_output->state->state().mode) {
if (m->m_mode)
- LOGM(LOG, " | sending current mode for {}: {}x{}@{}", m_monitor->m_name, m->m_mode->pixelSize.x, m->m_mode->pixelSize.y, m->m_mode->refreshRate);
+ LOGM(Log::DEBUG, " | sending current mode for {}: {}x{}@{}", m_monitor->m_name, m->m_mode->pixelSize.x, m->m_mode->pixelSize.y, m->m_mode->refreshRate);
else
- LOGM(LOG, " | sending current mode for {}: null (fake)", m_monitor->m_name);
+ LOGM(Log::DEBUG, " | sending current mode for {}: null (fake)", m_monitor->m_name);
m_resource->sendCurrentMode(m->m_resource.get());
break;
}
@@ -202,9 +202,9 @@ void COutputHead::updateMode() {
if (m->m_mode == m_monitor->m_currentMode) {
if (m->m_mode)
- LOGM(LOG, " | sending current mode for {}: {}x{}@{}", m_monitor->m_name, m->m_mode->pixelSize.x, m->m_mode->pixelSize.y, m->m_mode->refreshRate);
+ LOGM(Log::DEBUG, " | sending current mode for {}: {}x{}@{}", m_monitor->m_name, m->m_mode->pixelSize.x, m->m_mode->pixelSize.y, m->m_mode->refreshRate);
else
- LOGM(LOG, " | sending current mode for {}: null (fake)", m_monitor->m_name);
+ LOGM(Log::DEBUG, " | sending current mode for {}: null (fake)", m_monitor->m_name);
m_resource->sendCurrentMode(m->m_resource.get());
break;
}
@@ -243,7 +243,7 @@ void COutputMode::sendAllData() {
if (!m_mode)
return;
- LOGM(LOG, " | sending mode {}x{}@{}mHz, pref: {}", m_mode->pixelSize.x, m_mode->pixelSize.y, m_mode->refreshRate, m_mode->preferred);
+ LOGM(Log::DEBUG, " | sending mode {}x{}@{}mHz, pref: {}", m_mode->pixelSize.x, m_mode->pixelSize.y, m_mode->refreshRate, m_mode->preferred);
m_resource->sendSize(m_mode->pixelSize.x, m_mode->pixelSize.y);
if (m_mode->refreshRate > 0)
@@ -271,14 +271,14 @@ COutputConfiguration::COutputConfiguration(SP<CZwlrOutputConfigurationV1> resour
const auto HEAD = PROTO::outputManagement->headFromResource(outputHead);
if (!HEAD) {
- LOGM(ERR, "No head in setEnableHead??");
+ LOGM(Log::ERR, "No head in setEnableHead??");
return;
}
const auto PMONITOR = HEAD->monitor();
if (!PMONITOR) {
- LOGM(ERR, "No monitor in setEnableHead??");
+ LOGM(Log::ERR, "No monitor in setEnableHead??");
return;
}
@@ -293,25 +293,25 @@ COutputConfiguration::COutputConfiguration(SP<CZwlrOutputConfigurationV1> resour
m_heads.emplace_back(RESOURCE);
- LOGM(LOG, "enableHead on {}. For now, doing nothing. Waiting for apply().", PMONITOR->m_name);
+ LOGM(Log::DEBUG, "enableHead on {}. For now, doing nothing. Waiting for apply().", PMONITOR->m_name);
});
m_resource->setDisableHead([this](CZwlrOutputConfigurationV1* r, wl_resource* outputHead) {
const auto HEAD = PROTO::outputManagement->headFromResource(outputHead);
if (!HEAD) {
- LOGM(ERR, "No head in setDisableHead??");
+ LOGM(Log::ERR, "No head in setDisableHead??");
return;
}
const auto PMONITOR = HEAD->monitor();
if (!PMONITOR) {
- LOGM(ERR, "No monitor in setDisableHead??");
+ LOGM(Log::ERR, "No monitor in setDisableHead??");
return;
}
- LOGM(LOG, "disableHead on {}", PMONITOR->m_name);
+ LOGM(Log::DEBUG, "disableHead on {}", PMONITOR->m_name);
SWlrManagerSavedOutputState newState;
if (m_owner->m_monitorStates.contains(PMONITOR->m_name))
@@ -351,14 +351,14 @@ bool COutputConfiguration::good() {
bool COutputConfiguration::applyTestConfiguration(bool test) {
if (test) {
- LOGM(WARN, "TODO: STUB: applyTestConfiguration for test not implemented, returning true.");
+ LOGM(Log::WARN, "TODO: STUB: applyTestConfiguration for test not implemented, returning true.");
return true;
}
- LOGM(LOG, "Applying configuration");
+ LOGM(Log::DEBUG, "Applying configuration");
if (!m_owner) {
- LOGM(ERR, "applyTestConfiguration: no owner?!");
+ LOGM(Log::ERR, "applyTestConfiguration: no owner?!");
return false;
}
@@ -373,7 +373,7 @@ bool COutputConfiguration::applyTestConfiguration(bool test) {
if (!PMONITOR)
continue;
- LOGM(LOG, "Saving config for monitor {}", PMONITOR->m_name);
+ LOGM(Log::DEBUG, "Saving config for monitor {}", PMONITOR->m_name);
SWlrManagerSavedOutputState newState;
if (m_owner->m_monitorStates.contains(PMONITOR->m_name))
@@ -385,36 +385,36 @@ bool COutputConfiguration::applyTestConfiguration(bool test) {
newState.resolution = head->m_state.mode->getMode()->pixelSize;
newState.refresh = head->m_state.mode->getMode()->refreshRate;
newState.committedProperties |= eWlrOutputCommittedProperties::OUTPUT_HEAD_COMMITTED_MODE;
- LOGM(LOG, " > Mode: {:.0f}x{:.0f}@{}mHz", newState.resolution.x, newState.resolution.y, newState.refresh);
+ LOGM(Log::DEBUG, " > Mode: {:.0f}x{:.0f}@{}mHz", newState.resolution.x, newState.resolution.y, newState.refresh);
} else if (head->m_state.committedProperties & eWlrOutputCommittedProperties::OUTPUT_HEAD_COMMITTED_CUSTOM_MODE) {
newState.resolution = head->m_state.customMode.size;
newState.refresh = head->m_state.customMode.refresh;
newState.committedProperties |= eWlrOutputCommittedProperties::OUTPUT_HEAD_COMMITTED_CUSTOM_MODE;
- LOGM(LOG, " > Custom mode: {:.0f}x{:.0f}@{}mHz", newState.resolution.x, newState.resolution.y, newState.refresh);
+ LOGM(Log::DEBUG, " > Custom mode: {:.0f}x{:.0f}@{}mHz", newState.resolution.x, newState.resolution.y, newState.refresh);
}
if (head->m_state.committedProperties & eWlrOutputCommittedProperties::OUTPUT_HEAD_COMMITTED_POSITION) {
newState.position = head->m_state.position;
newState.committedProperties |= eWlrOutputCommittedProperties::OUTPUT_HEAD_COMMITTED_POSITION;
- LOGM(LOG, " > Position: {:.0f}, {:.0f}", head->m_state.position.x, head->m_state.position.y);
+ LOGM(Log::DEBUG, " > Position: {:.0f}, {:.0f}", head->m_state.position.x, head->m_state.position.y);
}
if (head->m_state.committedProperties & eWlrOutputCommittedProperties::OUTPUT_HEAD_COMMITTED_ADAPTIVE_SYNC) {
newState.adaptiveSync = head->m_state.adaptiveSync;
newState.committedProperties |= eWlrOutputCommittedProperties::OUTPUT_HEAD_COMMITTED_ADAPTIVE_SYNC;
- LOGM(LOG, " > vrr: {}", newState.adaptiveSync);
+ LOGM(Log::DEBUG, " > vrr: {}", newState.adaptiveSync);
}
if (head->m_state.committedProperties & eWlrOutputCommittedProperties::OUTPUT_HEAD_COMMITTED_SCALE) {
newState.scale = head->m_state.scale;
newState.committedProperties |= eWlrOutputCommittedProperties::OUTPUT_HEAD_COMMITTED_SCALE;
- LOGM(LOG, " > scale: {:.2f}", newState.scale);
+ LOGM(Log::DEBUG, " > scale: {:.2f}", newState.scale);
}
if (head->m_state.committedProperties & eWlrOutputCommittedProperties::OUTPUT_HEAD_COMMITTED_TRANSFORM) {
newState.transform = head->m_state.transform;
newState.committedProperties |= eWlrOutputCommittedProperties::OUTPUT_HEAD_COMMITTED_TRANSFORM;
- LOGM(LOG, " > transform: {}", (uint8_t)newState.transform);
+ LOGM(Log::DEBUG, " > transform: {}", (uint8_t)newState.transform);
}
// reset properties for next set.
@@ -425,7 +425,7 @@ bool COutputConfiguration::applyTestConfiguration(bool test) {
m_owner->m_monitorStates[PMONITOR->m_name] = newState;
}
- LOGM(LOG, "Saved configuration");
+ LOGM(Log::DEBUG, "Saved configuration");
return true;
}
@@ -440,12 +440,12 @@ COutputConfigurationHead::COutputConfigurationHead(SP<CZwlrOutputConfigurationHe
const auto MODE = PROTO::outputManagement->modeFromResource(outputMode);
if (!MODE || !MODE->getMode()) {
- LOGM(ERR, "No mode in setMode??");
+ LOGM(Log::ERR, "No mode in setMode??");
return;
}
if (!m_monitor) {
- LOGM(ERR, "setMode on inert resource");
+ LOGM(Log::ERR, "setMode on inert resource");
return;
}
@@ -457,12 +457,12 @@ COutputConfigurationHead::COutputConfigurationHead(SP<CZwlrOutputConfigurationHe
m_state.committedProperties |= OUTPUT_HEAD_COMMITTED_MODE;
m_state.mode = MODE;
- LOGM(LOG, " | configHead for {}: set mode to {}x{}@{}", m_monitor->m_name, MODE->getMode()->pixelSize.x, MODE->getMode()->pixelSize.y, MODE->getMode()->refreshRate);
+ LOGM(Log::DEBUG, " | configHead for {}: set mode to {}x{}@{}", m_monitor->m_name, MODE->getMode()->pixelSize.x, MODE->getMode()->pixelSize.y, MODE->getMode()->refreshRate);
});
m_resource->setSetCustomMode([this](CZwlrOutputConfigurationHeadV1* r, int32_t w, int32_t h, int32_t refresh) {
if (!m_monitor) {
- LOGM(ERR, "setCustomMode on inert resource");
+ LOGM(Log::ERR, "setCustomMode on inert resource");
return;
}
@@ -477,19 +477,19 @@ COutputConfigurationHead::COutputConfigurationHead(SP<CZwlrOutputConfigurationHe
}
if (refresh == 0) {
- LOGM(LOG, " | configHead for {}: refreshRate 0, using old refresh rate of {:.2f}Hz", m_monitor->m_name, m_monitor->m_refreshRate);
+ LOGM(Log::DEBUG, " | configHead for {}: refreshRate 0, using old refresh rate of {:.2f}Hz", m_monitor->m_name, m_monitor->m_refreshRate);
refresh = std::round(m_monitor->m_refreshRate * 1000.F);
}
m_state.committedProperties |= OUTPUT_HEAD_COMMITTED_CUSTOM_MODE;
m_state.customMode = {{w, h}, sc<uint32_t>(refresh)};
- LOGM(LOG, " | configHead for {}: set custom mode to {}x{}@{}", m_monitor->m_name, w, h, refresh);
+ LOGM(Log::DEBUG, " | configHead for {}: set custom mode to {}x{}@{}", m_monitor->m_name, w, h, refresh);
});
m_resource->setSetPosition([this](CZwlrOutputConfigurationHeadV1* r, int32_t x, int32_t y) {
if (!m_monitor) {
- LOGM(ERR, "setMode on inert resource");
+ LOGM(Log::ERR, "setMode on inert resource");
return;
}
@@ -501,12 +501,12 @@ COutputConfigurationHead::COutputConfigurationHead(SP<CZwlrOutputConfigurationHe
m_state.committedProperties |= OUTPUT_HEAD_COMMITTED_POSITION;
m_state.position = {x, y};
- LOGM(LOG, " | configHead for {}: set pos to {}, {}", m_monitor->m_name, x, y);
+ LOGM(Log::DEBUG, " | configHead for {}: set pos to {}, {}", m_monitor->m_name, x, y);
});
m_resource->setSetTransform([this](CZwlrOutputConfigurationHeadV1* r, int32_t transform) {
if (!m_monitor) {
- LOGM(ERR, "setMode on inert resource");
+ LOGM(Log::ERR, "setMode on inert resource");
return;
}
@@ -523,12 +523,12 @@ COutputConfigurationHead::COutputConfigurationHead(SP<CZwlrOutputConfigurationHe
m_state.committedProperties |= OUTPUT_HEAD_COMMITTED_TRANSFORM;
m_state.transform = sc<wl_output_transform>(transform);
- LOGM(LOG, " | configHead for {}: set transform to {}", m_monitor->m_name, transform);
+ LOGM(Log::DEBUG, " | configHead for {}: set transform to {}", m_monitor->m_name, transform);
});
m_resource->setSetScale([this](CZwlrOutputConfigurationHeadV1* r, wl_fixed_t scale_) {
if (!m_monitor) {
- LOGM(ERR, "setMode on inert resource");
+ LOGM(Log::ERR, "setMode on inert resource");
return;
}
@@ -547,12 +547,12 @@ COutputConfigurationHead::COutputConfigurationHead(SP<CZwlrOutputConfigurationHe
m_state.committedProperties |= OUTPUT_HEAD_COMMITTED_SCALE;
m_state.scale = scale;
- LOGM(LOG, " | configHead for {}: set scale to {:.2f}", m_monitor->m_name, scale);
+ LOGM(Log::DEBUG, " | configHead for {}: set scale to {:.2f}", m_monitor->m_name, scale);
});
m_resource->setSetAdaptiveSync([this](CZwlrOutputConfigurationHeadV1* r, uint32_t as) {
if (!m_monitor) {
- LOGM(ERR, "setMode on inert resource");
+ LOGM(Log::ERR, "setMode on inert resource");
return;
}
@@ -569,7 +569,7 @@ COutputConfigurationHead::COutputConfigurationHead(SP<CZwlrOutputConfigurationHe
m_state.committedProperties |= OUTPUT_HEAD_COMMITTED_ADAPTIVE_SYNC;
m_state.adaptiveSync = as;
- LOGM(LOG, " | configHead for {}: set adaptiveSync to {}", m_monitor->m_name, as);
+ LOGM(Log::DEBUG, " | configHead for {}: set adaptiveSync to {}", m_monitor->m_name, as);
});
}
@@ -657,7 +657,7 @@ void COutputManagementProtocol::sendPendingSuccessEvents() {
if (m_pendingConfigurationSuccessEvents.empty())
return;
- LOGM(LOG, "Sending {} pending configuration success events", m_pendingConfigurationSuccessEvents.size());
+ LOGM(Log::DEBUG, "Sending {} pending configuration success events", m_pendingConfigurationSuccessEvents.size());
for (auto const& config : m_pendingConfigurationSuccessEvents) {
if (!config)
diff --git a/src/protocols/PointerConstraints.cpp b/src/protocols/PointerConstraints.cpp
index 1277ba12..a78f3548 100644
--- a/src/protocols/PointerConstraints.cpp
+++ b/src/protocols/PointerConstraints.cpp
@@ -217,14 +217,14 @@ void CPointerConstraintsProtocol::destroyPointerConstraint(CPointerConstraint* h
void CPointerConstraintsProtocol::onNewConstraint(SP<CPointerConstraint> constraint, CZwpPointerConstraintsV1* pMgr) {
if UNLIKELY (!constraint->good()) {
- LOGM(ERR, "Couldn't create constraint??");
+ LOGM(Log::ERR, "Couldn't create constraint??");
pMgr->noMemory();
m_constraints.pop_back();
return;
}
if UNLIKELY (!constraint->owner()) {
- LOGM(ERR, "New constraint has no CWLSurface owner??");
+ LOGM(Log::ERR, "New constraint has no CWLSurface owner??");
return;
}
@@ -233,7 +233,7 @@ void CPointerConstraintsProtocol::onNewConstraint(SP<CPointerConstraint> constra
const auto DUPES = std::ranges::count_if(m_constraints, [OWNER](const auto& c) { return c->owner() == OWNER; });
if UNLIKELY (DUPES > 1) {
- LOGM(ERR, "Constraint for surface duped");
+ LOGM(Log::ERR, "Constraint for surface duped");
pMgr->error(ZWP_POINTER_CONSTRAINTS_V1_ERROR_ALREADY_CONSTRAINED, "Surface already confined");
m_constraints.pop_back();
return;
diff --git a/src/protocols/PointerGestures.cpp b/src/protocols/PointerGestures.cpp
index 00576778..eb14bbf8 100644
--- a/src/protocols/PointerGestures.cpp
+++ b/src/protocols/PointerGestures.cpp
@@ -75,7 +75,7 @@ void CPointerGesturesProtocol::onGetPinchGesture(CZwpPointerGesturesV1* pMgr, ui
if UNLIKELY (!RESOURCE->good()) {
pMgr->noMemory();
- LOGM(ERR, "Couldn't create gesture");
+ LOGM(Log::ERR, "Couldn't create gesture");
return;
}
}
@@ -86,7 +86,7 @@ void CPointerGesturesProtocol::onGetSwipeGesture(CZwpPointerGesturesV1* pMgr, ui
if UNLIKELY (!RESOURCE->good()) {
pMgr->noMemory();
- LOGM(ERR, "Couldn't create gesture");
+ LOGM(Log::ERR, "Couldn't create gesture");
return;
}
}
@@ -97,7 +97,7 @@ void CPointerGesturesProtocol::onGetHoldGesture(CZwpPointerGesturesV1* pMgr, uin
if UNLIKELY (!RESOURCE->good()) {
pMgr->noMemory();
- LOGM(ERR, "Couldn't create gesture");
+ LOGM(Log::ERR, "Couldn't create gesture");
return;
}
}
diff --git a/src/protocols/PointerWarp.cpp b/src/protocols/PointerWarp.cpp
index 83be492e..a297a04d 100644
--- a/src/protocols/PointerWarp.cpp
+++ b/src/protocols/PointerWarp.cpp
@@ -41,7 +41,7 @@ void CPointerWarpProtocol::bindManager(wl_client* client, void* data, uint32_t v
if (!g_pSeatManager->serialValid(PSEAT, serial, false))
return;
- LOGM(LOG, "warped pointer to {}", GLOBALPOS);
+ LOGM(Log::DEBUG, "warped pointer to {}", GLOBALPOS);
g_pPointerManager->warpTo(GLOBALPOS);
g_pSeatManager->sendPointerMotion(Time::millis(Time::steadyNow()), LOCALPOS);
diff --git a/src/protocols/PresentationTime.cpp b/src/protocols/PresentationTime.cpp
index 9849eb35..82c4b1eb 100644
--- a/src/protocols/PresentationTime.cpp
+++ b/src/protocols/PresentationTime.cpp
@@ -126,7 +126,7 @@ void CPresentationProtocol::onPresented(PHLMONITOR pMonitor, const Time::steady_
}
if (m_feedbacks.size() > 10000) {
- LOGM(ERR, "FIXME: presentation has a feedback leak, and has grown to {} pending entries!!! Dropping!!!!!", m_feedbacks.size());
+ LOGM(Log::ERR, "FIXME: presentation has a feedback leak, and has grown to {} pending entries!!! Dropping!!!!!", m_feedbacks.size());
// Move the elements from the 9000th position to the end of the vector.
std::vector<UP<CPresentationFeedback>> newFeedbacks;
diff --git a/src/protocols/PrimarySelection.cpp b/src/protocols/PrimarySelection.cpp
index dd0eefad..7da1fa0a 100644
--- a/src/protocols/PrimarySelection.cpp
+++ b/src/protocols/PrimarySelection.cpp
@@ -15,16 +15,16 @@ CPrimarySelectionOffer::CPrimarySelectionOffer(SP<CZwpPrimarySelectionOfferV1> r
m_resource->setReceive([this](CZwpPrimarySelectionOfferV1* r, const char* mime, int32_t 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());
m_source->send(mime, std::move(sendFd));
});
@@ -80,7 +80,7 @@ std::vector<std::string> CPrimarySelectionSource::mimes() {
void CPrimarySelectionSource::send(const std::string& mime, CFileDescriptor fd) {
if (std::ranges::find(m_mimeTypes, mime) == m_mimeTypes.end()) {
- LOGM(ERR, "Compositor/App bug: CPrimarySelectionSource::sendAskSend with non-existent mime");
+ LOGM(Log::ERR, "Compositor/App bug: CPrimarySelectionSource::sendAskSend with non-existent mime");
return;
}
@@ -89,7 +89,7 @@ void CPrimarySelectionSource::send(const std::string& mime, CFileDescriptor fd)
void CPrimarySelectionSource::accepted(const std::string& mime) {
if (std::ranges::find(m_mimeTypes, mime) == m_mimeTypes.end())
- LOGM(ERR, "Compositor/App bug: CPrimarySelectionSource::sendAccepted with non-existent mime");
+ LOGM(Log::ERR, "Compositor/App bug: CPrimarySelectionSource::sendAccepted with non-existent mime");
// primary sel has no accepted
}
@@ -115,24 +115,24 @@ CPrimarySelectionDevice::CPrimarySelectionDevice(SP<CZwpPrimarySelectionDeviceV1
static auto PPRIMARYSEL = CConfigValue<Hyprlang::INT>("misc:middle_click_paste");
if (!*PPRIMARYSEL) {
- LOGM(LOG, "Ignoring primary selection: disabled in config");
+ LOGM(Log::DEBUG, "Ignoring primary selection: disabled in config");
g_pSeatManager->setCurrentPrimarySelection(nullptr);
return;
}
auto source = sourceR ? CPrimarySelectionSource::fromResource(sourceR) : CSharedPointer<CPrimarySelectionSource>{};
if (!source) {
- LOGM(LOG, "wlr reset selection received");
+ LOGM(Log::DEBUG, "wlr reset selection received");
g_pSeatManager->setCurrentPrimarySelection(nullptr);
return;
}
if (source && source->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();
- LOGM(LOG, "wlr manager requests selection to {:x}", (uintptr_t)source.get());
+ LOGM(Log::DEBUG, "wlr manager requests selection to {:x}", (uintptr_t)source.get());
g_pSeatManager->setCurrentPrimarySelection(source);
});
}
@@ -181,7 +181,7 @@ CPrimarySelectionManager::CPrimarySelectionManager(SP<CZwpPrimarySelectionDevice
s->m_device = RESOURCE;
}
- LOGM(LOG, "New primary selection data device bound at {:x}", (uintptr_t)RESOURCE.get());
+ LOGM(Log::DEBUG, "New primary selection data device bound at {:x}", (uintptr_t)RESOURCE.get());
});
m_resource->setCreateSource([this](CZwpPrimarySelectionDeviceManagerV1* r, uint32_t id) {
@@ -197,13 +197,13 @@ CPrimarySelectionManager::CPrimarySelectionManager(SP<CZwpPrimarySelectionDevice
}
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 primary selection data source bound at {:x}", (uintptr_t)RESOURCE.get());
+ LOGM(Log::DEBUG, "New primary selection data source bound at {:x}", (uintptr_t)RESOURCE.get());
});
}
@@ -224,7 +224,7 @@ void CPrimarySelectionProtocol::bindManager(wl_client* client, void* data, uint3
return;
}
- LOGM(LOG, "New primary_seletion_manager at {:x}", (uintptr_t)RESOURCE.get());
+ LOGM(Log::DEBUG, "New primary_seletion_manager at {:x}", (uintptr_t)RESOURCE.get());
// we need to do it here because protocols come before seatMgr
if (!m_listeners.onPointerFocusChange)
@@ -262,7 +262,7 @@ void CPrimarySelectionProtocol::sendSelectionToDevice(SP<CPrimarySelectionDevice
return;
}
- LOGM(LOG, "New offer {:x} for data source {:x}", (uintptr_t)OFFER.get(), (uintptr_t)sel.get());
+ LOGM(Log::DEBUG, "New offer {:x} for data source {:x}", (uintptr_t)OFFER.get(), (uintptr_t)sel.get());
dev->sendDataOffer(OFFER);
OFFER->sendData();
@@ -277,7 +277,7 @@ void CPrimarySelectionProtocol::setSelection(SP<IDataSource> source) {
}
if (!source) {
- LOGM(LOG, "resetting selection");
+ LOGM(Log::DEBUG, "resetting selection");
if (!g_pSeatManager->m_state.pointerFocusResource)
return;
@@ -289,7 +289,7 @@ void CPrimarySelectionProtocol::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.pointerFocusResource)
return;
@@ -297,7 +297,7 @@ void CPrimarySelectionProtocol::setSelection(SP<IDataSource> source) {
auto DESTDEVICE = dataDeviceForClient(g_pSeatManager->m_state.pointerFocusResource->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");
g_pSeatManager->m_selection.currentPrimarySelection.reset();
return;
}
@@ -313,7 +313,7 @@ void CPrimarySelectionProtocol::updateSelection() {
auto DESTDEVICE = dataDeviceForClient(g_pSeatManager->m_state.pointerFocusResource->client());
if (!selection || !DESTDEVICE) {
- LOGM(LOG, "CPrimarySelectionProtocol::updateSelection: cannot send selection to a client without a data_device");
+ LOGM(Log::DEBUG, "CPrimarySelectionProtocol::updateSelection: cannot send selection to a client without a data_device");
return;
}
diff --git a/src/protocols/Screencopy.cpp b/src/protocols/Screencopy.cpp
index 36b11298..5507b5b3 100644
--- a/src/protocols/Screencopy.cpp
+++ b/src/protocols/Screencopy.cpp
@@ -27,7 +27,7 @@ CScreencopyFrame::CScreencopyFrame(SP<CZwlrScreencopyFrameV1> resource_, int32_t
m_monitor = CWLOutputResource::fromResource(output)->m_monitor;
if (!m_monitor) {
- LOGM(ERR, "Client requested sharing of a monitor that doesn't exist");
+ LOGM(Log::ERR, "Client requested sharing of a monitor that doesn't exist");
m_resource->sendFailed();
return;
}
@@ -44,7 +44,7 @@ CScreencopyFrame::CScreencopyFrame(SP<CZwlrScreencopyFrameV1> resource_, int32_t
m_shmFormat = g_pHyprOpenGL->getPreferredReadFormat(m_monitor.lock());
if (m_shmFormat == DRM_FORMAT_INVALID) {
- LOGM(ERR, "No format supported by renderer in capture output");
+ LOGM(Log::ERR, "No format supported by renderer in capture output");
m_resource->sendFailed();
return;
}
@@ -55,7 +55,7 @@ CScreencopyFrame::CScreencopyFrame(SP<CZwlrScreencopyFrameV1> resource_, int32_t
const auto PSHMINFO = NFormatUtils::getPixelFormatFromDRM(m_shmFormat);
if (!PSHMINFO) {
- LOGM(ERR, "No pixel format supported by renderer in capture output");
+ LOGM(Log::ERR, "No pixel format supported by renderer in capture output");
m_resource->sendFailed();
return;
}
@@ -86,33 +86,33 @@ CScreencopyFrame::CScreencopyFrame(SP<CZwlrScreencopyFrameV1> resource_, int32_t
void CScreencopyFrame::copy(CZwlrScreencopyFrameV1* pFrame, wl_resource* buffer_) {
if UNLIKELY (!good()) {
- LOGM(ERR, "No frame in copyFrame??");
+ LOGM(Log::ERR, "No frame in copyFrame??");
return;
}
if UNLIKELY (!g_pCompositor->monitorExists(m_monitor.lock())) {
- LOGM(ERR, "Client requested sharing of a monitor that is gone");
+ LOGM(Log::ERR, "Client requested sharing of a monitor that is gone");
m_resource->sendFailed();
return;
}
const auto PBUFFER = CWLBufferResource::fromResource(buffer_);
if UNLIKELY (!PBUFFER) {
- LOGM(ERR, "Invalid buffer in {:x}", (uintptr_t)this);
+ LOGM(Log::ERR, "Invalid buffer in {:x}", (uintptr_t)this);
m_resource->error(ZWLR_SCREENCOPY_FRAME_V1_ERROR_INVALID_BUFFER, "invalid buffer");
PROTO::screencopy->destroyResource(this);
return;
}
if UNLIKELY (PBUFFER->m_buffer->size != m_box.size()) {
- LOGM(ERR, "Invalid dimensions in {:x}", (uintptr_t)this);
+ LOGM(Log::ERR, "Invalid dimensions in {:x}", (uintptr_t)this);
m_resource->error(ZWLR_SCREENCOPY_FRAME_V1_ERROR_INVALID_BUFFER, "invalid buffer dimensions");
PROTO::screencopy->destroyResource(this);
return;
}
if UNLIKELY (m_buffer) {
- LOGM(ERR, "Buffer used in {:x}", (uintptr_t)this);
+ LOGM(Log::ERR, "Buffer used in {:x}", (uintptr_t)this);
m_resource->error(ZWLR_SCREENCOPY_FRAME_V1_ERROR_ALREADY_USED, "frame already used");
PROTO::screencopy->destroyResource(this);
return;
@@ -122,25 +122,25 @@ void CScreencopyFrame::copy(CZwlrScreencopyFrameV1* pFrame, wl_resource* buffer_
m_bufferDMA = true;
if (attrs.format != m_dmabufFormat) {
- LOGM(ERR, "Invalid buffer dma format in {:x}", (uintptr_t)pFrame);
+ LOGM(Log::ERR, "Invalid buffer dma format in {:x}", (uintptr_t)pFrame);
m_resource->error(ZWLR_SCREENCOPY_FRAME_V1_ERROR_INVALID_BUFFER, "invalid buffer format");
PROTO::screencopy->destroyResource(this);
return;
}
} else if (auto attrs = PBUFFER->m_buffer->shm(); attrs.success) {
if (attrs.format != m_shmFormat) {
- LOGM(ERR, "Invalid buffer shm format in {:x}", (uintptr_t)pFrame);
+ LOGM(Log::ERR, "Invalid buffer shm format in {:x}", (uintptr_t)pFrame);
m_resource->error(ZWLR_SCREENCOPY_FRAME_V1_ERROR_INVALID_BUFFER, "invalid buffer format");
PROTO::screencopy->destroyResource(this);
return;
} else if (attrs.stride != m_shmStride) {
- LOGM(ERR, "Invalid buffer shm stride in {:x}", (uintptr_t)pFrame);
+ LOGM(Log::ERR, "Invalid buffer shm stride in {:x}", (uintptr_t)pFrame);
m_resource->error(ZWLR_SCREENCOPY_FRAME_V1_ERROR_INVALID_BUFFER, "invalid buffer stride");
PROTO::screencopy->destroyResource(this);
return;
}
} else {
- LOGM(ERR, "Invalid buffer type in {:x}", (uintptr_t)pFrame);
+ LOGM(Log::ERR, "Invalid buffer type in {:x}", (uintptr_t)pFrame);
m_resource->error(ZWLR_SCREENCOPY_FRAME_V1_ERROR_INVALID_BUFFER, "invalid buffer type");
PROTO::screencopy->destroyResource(this);
return;
@@ -167,7 +167,7 @@ void CScreencopyFrame::share() {
return;
if (!success) {
- LOGM(ERR, "{} copy failed in {:x}", m_bufferDMA ? "Dmabuf" : "Shm", (uintptr_t)this);
+ LOGM(Log::ERR, "{} copy failed in {:x}", m_bufferDMA ? "Dmabuf" : "Shm", (uintptr_t)this);
m_resource->sendFailed();
return;
}
@@ -300,7 +300,7 @@ void CScreencopyFrame::storeTempFB() {
CRegion fakeDamage = {0, 0, INT16_MAX, INT16_MAX};
if (!g_pHyprRenderer->beginRender(m_monitor.lock(), fakeDamage, RENDER_MODE_FULL_FAKE, nullptr, &m_tempFb, true)) {
- LOGM(ERR, "Can't copy: failed to begin rendering to temp fb");
+ LOGM(Log::ERR, "Can't copy: failed to begin rendering to temp fb");
return;
}
@@ -315,7 +315,7 @@ void CScreencopyFrame::copyDmabuf(std::function<void(bool)> callback) {
CRegion fakeDamage = {0, 0, INT16_MAX, INT16_MAX};
if (!g_pHyprRenderer->beginRender(m_monitor.lock(), fakeDamage, RENDER_MODE_TO_BUFFER, m_buffer.m_buffer, nullptr, true)) {
- LOGM(ERR, "Can't copy: failed to begin rendering to dma frame");
+ LOGM(Log::ERR, "Can't copy: failed to begin rendering to dma frame");
callback(false);
return;
}
@@ -338,7 +338,7 @@ void CScreencopyFrame::copyDmabuf(std::function<void(bool)> callback) {
g_pHyprOpenGL->m_renderData.blockScreenShader = true;
g_pHyprRenderer->endRender([callback]() {
- LOGM(TRACE, "Copied frame via dma");
+ LOGM(Log::TRACE, "Copied frame via dma");
callback(true);
});
}
@@ -357,7 +357,7 @@ bool CScreencopyFrame::copyShm() {
fb.alloc(m_box.w, m_box.h, m_monitor->m_output->state->state().drmFormat);
if (!g_pHyprRenderer->beginRender(m_monitor.lock(), fakeDamage, RENDER_MODE_FULL_FAKE, nullptr, &fb, true)) {
- LOGM(ERR, "Can't copy: failed to begin rendering");
+ LOGM(Log::ERR, "Can't copy: failed to begin rendering");
return false;
}
@@ -380,7 +380,7 @@ bool CScreencopyFrame::copyShm() {
const auto PFORMAT = NFormatUtils::getPixelFormatFromDRM(shm.format);
if (!PFORMAT) {
- LOGM(ERR, "Can't copy: failed to find a pixel format");
+ LOGM(Log::ERR, "Can't copy: failed to find a pixel format");
g_pHyprRenderer->endRender();
return false;
}
@@ -414,7 +414,7 @@ bool CScreencopyFrame::copyShm() {
glBindFramebuffer(GL_READ_FRAMEBUFFER, 0);
- LOGM(TRACE, "Copied frame via shm");
+ LOGM(Log::TRACE, "Copied frame via shm");
return true;
}
@@ -448,7 +448,7 @@ void CScreencopyClient::captureOutput(uint32_t frame, int32_t overlayCursor_, wl
makeShared<CScreencopyFrame>(makeShared<CZwlrScreencopyFrameV1>(m_resource->client(), m_resource->version(), frame), overlayCursor_, output, box));
if (!FRAME->good()) {
- LOGM(ERR, "Couldn't alloc frame for sharing! (no memory)");
+ LOGM(Log::ERR, "Couldn't alloc frame for sharing! (no memory)");
m_resource->noMemory();
PROTO::screencopy->destroyResource(FRAME.get());
return;
@@ -496,7 +496,7 @@ void CScreencopyProtocol::bindManager(wl_client* client, void* data, uint32_t ve
const auto CLIENT = m_clients.emplace_back(makeShared<CScreencopyClient>(makeShared<CZwlrScreencopyManagerV1>(client, ver, id)));
if (!CLIENT->good()) {
- LOGM(LOG, "Failed to bind client! (out of memory)");
+ LOGM(Log::DEBUG, "Failed to bind client! (out of memory)");
CLIENT->m_resource->noMemory();
m_clients.pop_back();
return;
@@ -504,7 +504,7 @@ void CScreencopyProtocol::bindManager(wl_client* client, void* data, uint32_t ve
CLIENT->m_self = CLIENT;
- LOGM(LOG, "Bound client successfully!");
+ LOGM(Log::DEBUG, "Bound client successfully!");
}
void CScreencopyProtocol::destroyResource(CScreencopyClient* client) {
diff --git a/src/protocols/SecurityContext.cpp b/src/protocols/SecurityContext.cpp
index 00f7b4d8..6c7f8226 100644
--- a/src/protocols/SecurityContext.cpp
+++ b/src/protocols/SecurityContext.cpp
@@ -53,15 +53,15 @@ CSecurityContext::CSecurityContext(SP<CWpSecurityContextV1> resource_, int liste
return;
m_resource->setDestroy([this](CWpSecurityContextV1* r) {
- LOGM(LOG, "security_context at 0x{:x}: resource destroyed, keeping context until fd hangup", (uintptr_t)this);
+ LOGM(Log::DEBUG, "security_context at 0x{:x}: resource destroyed, keeping context until fd hangup", (uintptr_t)this);
m_resource = nullptr;
});
m_resource->setOnDestroy([this](CWpSecurityContextV1* r) {
- LOGM(LOG, "security_context at 0x{:x}: resource destroyed, keeping context until fd hangup", (uintptr_t)this);
+ LOGM(Log::DEBUG, "security_context at 0x{:x}: resource destroyed, keeping context until fd hangup", (uintptr_t)this);
m_resource = nullptr;
});
- LOGM(LOG, "New security_context at 0x{:x}", (uintptr_t)this);
+ LOGM(Log::DEBUG, "New security_context at 0x{:x}", (uintptr_t)this);
m_resource->setSetSandboxEngine([this](CWpSecurityContextV1* r, const char* engine) {
if UNLIKELY (!m_sandboxEngine.empty()) {
@@ -75,7 +75,7 @@ CSecurityContext::CSecurityContext(SP<CWpSecurityContextV1> resource_, int liste
}
m_sandboxEngine = engine ? engine : "(null)";
- LOGM(LOG, "security_context at 0x{:x} sets engine to {}", (uintptr_t)this, m_sandboxEngine);
+ LOGM(Log::DEBUG, "security_context at 0x{:x} sets engine to {}", (uintptr_t)this, m_sandboxEngine);
});
m_resource->setSetAppId([this](CWpSecurityContextV1* r, const char* appid) {
@@ -90,7 +90,7 @@ CSecurityContext::CSecurityContext(SP<CWpSecurityContextV1> resource_, int liste
}
m_appID = appid ? appid : "(null)";
- LOGM(LOG, "security_context at 0x{:x} sets appid to {}", (uintptr_t)this, m_appID);
+ LOGM(Log::DEBUG, "security_context at 0x{:x} sets appid to {}", (uintptr_t)this, m_appID);
});
m_resource->setSetInstanceId([this](CWpSecurityContextV1* r, const char* instance) {
@@ -105,13 +105,13 @@ CSecurityContext::CSecurityContext(SP<CWpSecurityContextV1> resource_, int liste
}
m_instanceID = instance ? instance : "(null)";
- LOGM(LOG, "security_context at 0x{:x} sets instance to {}", (uintptr_t)this, m_instanceID);
+ LOGM(Log::DEBUG, "security_context at 0x{:x} sets instance to {}", (uintptr_t)this, m_instanceID);
});
m_resource->setCommit([this](CWpSecurityContextV1* r) {
m_committed = true;
- LOGM(LOG, "security_context at 0x{:x} commits", (uintptr_t)this);
+ LOGM(Log::DEBUG, "security_context at 0x{:x} commits", (uintptr_t)this);
m_listenSource = wl_event_loop_add_fd(g_pCompositor->m_wlEventLoop, m_listenFD.get(), WL_EVENT_READABLE, ::onListenFdEvent, this);
m_closeSource = wl_event_loop_add_fd(g_pCompositor->m_wlEventLoop, m_closeFD.get(), 0, ::onCloseFdEvent, this);
@@ -136,7 +136,7 @@ bool CSecurityContext::good() {
void CSecurityContext::onListen(uint32_t mask) {
if UNLIKELY (mask & (WL_EVENT_HANGUP | WL_EVENT_ERROR)) {
- LOGM(ERR, "security_context at 0x{:x} got an error in listen", (uintptr_t)this);
+ LOGM(Log::ERR, "security_context at 0x{:x} got an error in listen", (uintptr_t)this);
PROTO::securityContext->destroyContext(this);
return;
}
@@ -146,19 +146,19 @@ void CSecurityContext::onListen(uint32_t mask) {
CFileDescriptor clientFD{accept(m_listenFD.get(), nullptr, nullptr)};
if UNLIKELY (!clientFD.isValid()) {
- LOGM(ERR, "security_context at 0x{:x} couldn't accept", (uintptr_t)this);
+ LOGM(Log::ERR, "security_context at 0x{:x} couldn't accept", (uintptr_t)this);
return;
}
auto newClient = CSecurityContextSandboxedClient::create(std::move(clientFD));
if UNLIKELY (!newClient) {
- LOGM(ERR, "security_context at 0x{:x} couldn't create a client", (uintptr_t)this);
+ LOGM(Log::ERR, "security_context at 0x{:x} couldn't create a client", (uintptr_t)this);
return;
}
PROTO::securityContext->m_sandboxedClients.emplace_back(newClient);
- LOGM(LOG, "security_context at 0x{:x} got a new wl_client 0x{:x}", (uintptr_t)this, (uintptr_t)newClient->m_client);
+ LOGM(Log::DEBUG, "security_context at 0x{:x} got a new wl_client 0x{:x}", (uintptr_t)this, (uintptr_t)newClient->m_client);
}
void CSecurityContext::onClose(uint32_t mask) {
diff --git a/src/protocols/SessionLock.cpp b/src/protocols/SessionLock.cpp
index 3dab394b..88231f38 100644
--- a/src/protocols/SessionLock.cpp
+++ b/src/protocols/SessionLock.cpp
@@ -26,13 +26,13 @@ CSessionLockSurface::CSessionLockSurface(SP<CExtSessionLockSurfaceV1> resource_,
m_listeners.surfaceCommit = m_surface->m_events.commit.listen([this] {
if (!m_surface->m_current.texture) {
- LOGM(ERR, "SessionLock attached a null buffer");
+ LOGM(Log::ERR, "SessionLock attached a null buffer");
m_resource->error(EXT_SESSION_LOCK_SURFACE_V1_ERROR_NULL_BUFFER, "Null buffer attached");
return;
}
if (!m_ackdConfigure) {
- LOGM(ERR, "SessionLock committed without an ack");
+ LOGM(Log::ERR, "SessionLock committed without an ack");
m_resource->error(EXT_SESSION_LOCK_SURFACE_V1_ERROR_COMMIT_BEFORE_FIRST_ACK, "Committed surface before first ack");
return;
}
@@ -47,7 +47,7 @@ CSessionLockSurface::CSessionLockSurface(SP<CExtSessionLockSurfaceV1> resource_,
});
m_listeners.surfaceDestroy = m_surface->m_events.destroy.listen([this] {
- LOGM(WARN, "SessionLockSurface object remains but surface is being destroyed???");
+ LOGM(Log::WARN, "SessionLockSurface object remains but surface is being destroyed???");
m_surface->unmap();
m_listeners.surfaceCommit.reset();
m_listeners.surfaceDestroy.reset();
@@ -79,7 +79,7 @@ CSessionLockSurface::~CSessionLockSurface() {
void CSessionLockSurface::sendConfigure() {
if (!m_monitor) {
- LOGM(ERR, "sendConfigure: monitor is gone");
+ LOGM(Log::ERR, "sendConfigure: monitor is gone");
return;
}
@@ -112,7 +112,7 @@ CSessionLock::CSessionLock(SP<CExtSessionLockV1> resource_) : m_resource(resourc
m_resource->setGetLockSurface([this](CExtSessionLockV1* r, uint32_t id, wl_resource* surf, wl_resource* output) {
if (m_inert) {
- LOGM(ERR, "Lock is trying to send getLockSurface after it's inert");
+ LOGM(Log::ERR, "Lock is trying to send getLockSurface after it's inert");
return;
}
@@ -184,7 +184,7 @@ void CSessionLockProtocol::destroyResource(CSessionLockSurface* surf) {
void CSessionLockProtocol::onLock(CExtSessionLockManagerV1* pMgr, uint32_t id) {
- LOGM(LOG, "New sessionLock with id {}", id);
+ LOGM(Log::DEBUG, "New sessionLock with id {}", id);
const auto CLIENT = pMgr->client();
const auto RESOURCE = m_locks.emplace_back(makeShared<CSessionLock>(makeShared<CExtSessionLockV1>(CLIENT, pMgr->version(), id)));
@@ -201,7 +201,7 @@ void CSessionLockProtocol::onLock(CExtSessionLockManagerV1* pMgr, uint32_t id) {
}
void CSessionLockProtocol::onGetLockSurface(CExtSessionLockV1* lock, uint32_t id, wl_resource* surface, wl_resource* output) {
- LOGM(LOG, "New sessionLockSurface with id {}", id);
+ LOGM(Log::DEBUG, "New sessionLockSurface with id {}", id);
auto PSURFACE = CWLSurfaceResource::fromResource(surface);
auto PMONITOR = CWLOutputResource::fromResource(output)->m_monitor.lock();
diff --git a/src/protocols/ShortcutsInhibit.cpp b/src/protocols/ShortcutsInhibit.cpp
index e42bf172..6e6bf002 100644
--- a/src/protocols/ShortcutsInhibit.cpp
+++ b/src/protocols/ShortcutsInhibit.cpp
@@ -62,7 +62,7 @@ void CKeyboardShortcutsInhibitProtocol::onInhibit(CZwpKeyboardShortcutsInhibitMa
if UNLIKELY (!RESOURCE->good()) {
pMgr->noMemory();
m_inhibitors.pop_back();
- LOGM(ERR, "Failed to create an inhibitor resource");
+ LOGM(Log::ERR, "Failed to create an inhibitor resource");
return;
}
}
diff --git a/src/protocols/SinglePixel.cpp b/src/protocols/SinglePixel.cpp
index e291711d..51c3551c 100644
--- a/src/protocols/SinglePixel.cpp
+++ b/src/protocols/SinglePixel.cpp
@@ -4,7 +4,7 @@
#include "render/Renderer.hpp"
CSinglePixelBuffer::CSinglePixelBuffer(uint32_t id, wl_client* client, CHyprColor col_) {
- LOGM(LOG, "New single-pixel buffer with color 0x{:x}", col_.getAsHex());
+ LOGM(Log::DEBUG, "New single-pixel buffer with color 0x{:x}", col_.getAsHex());
m_color = col_.getAsHex();
@@ -21,7 +21,7 @@ CSinglePixelBuffer::CSinglePixelBuffer(uint32_t id, wl_client* client, CHyprColo
size = {1, 1};
if (!m_success)
- Debug::log(ERR, "Failed creating a single pixel texture: null texture id");
+ Log::logger->log(Log::ERR, "Failed creating a single pixel texture: null texture id");
}
CSinglePixelBuffer::~CSinglePixelBuffer() {
diff --git a/src/protocols/Tablet.cpp b/src/protocols/Tablet.cpp
index b4f3b3eb..00f811a4 100644
--- a/src/protocols/Tablet.cpp
+++ b/src/protocols/Tablet.cpp
@@ -549,7 +549,7 @@ void CTabletV2Protocol::proximityIn(SP<CTabletTool> tool, SP<CTablet> tablet, SP
continue;
if (t->m_seat.expired()) {
- LOGM(ERR, "proximityIn on a tool without a seat parent");
+ LOGM(Log::ERR, "proximityIn on a tool without a seat parent");
return;
}
@@ -571,7 +571,7 @@ void CTabletV2Protocol::proximityIn(SP<CTabletTool> tool, SP<CTablet> tablet, SP
}
if (!tabletResource || !toolResource) {
- LOGM(ERR, "proximityIn on a tool and tablet without valid resource(s)??");
+ LOGM(Log::ERR, "proximityIn on a tool and tablet without valid resource(s)??");
return;
}
@@ -582,7 +582,7 @@ void CTabletV2Protocol::proximityIn(SP<CTabletTool> tool, SP<CTablet> tablet, SP
toolResource->m_resource->sendProximityIn(serial, tabletResource->m_resource.get(), surf->getResource()->resource());
toolResource->queueFrame();
- LOGM(ERR, "proximityIn: found no resource to send enter");
+ LOGM(Log::ERR, "proximityIn: found no resource to send enter");
}
void CTabletV2Protocol::proximityOut(SP<CTabletTool> tool) {
@@ -623,7 +623,7 @@ void CTabletV2Protocol::mode(SP<CTabletPad> pad, uint32_t group, uint32_t mode,
if (t->m_pad != pad)
continue;
if (t->m_groups.size() <= group) {
- LOGM(ERR, "BUG THIS: group >= t->groups.size()");
+ LOGM(Log::ERR, "BUG THIS: group >= t->groups.size()");
return;
}
auto serial = g_pSeatManager->nextSerial(g_pSeatManager->seatResourceForClient(t->m_resource->client()));
@@ -640,9 +640,9 @@ void CTabletV2Protocol::buttonPad(SP<CTabletPad> pad, uint32_t button, uint32_t
}
void CTabletV2Protocol::strip(SP<CTabletPad> pad, uint32_t strip, double position, bool finger, uint32_t timeMs) {
- LOGM(ERR, "FIXME: STUB: CTabletV2Protocol::strip not implemented");
+ LOGM(Log::ERR, "FIXME: STUB: CTabletV2Protocol::strip not implemented");
}
void CTabletV2Protocol::ring(SP<CTabletPad> pad, uint32_t ring, double position, bool finger, uint32_t timeMs) {
- LOGM(ERR, "FIXME: STUB: CTabletV2Protocol::ring not implemented");
+ LOGM(Log::ERR, "FIXME: STUB: CTabletV2Protocol::ring not implemented");
}
diff --git a/src/protocols/TextInputV1.cpp b/src/protocols/TextInputV1.cpp
index 7143b081..d77bb736 100644
--- a/src/protocols/TextInputV1.cpp
+++ b/src/protocols/TextInputV1.cpp
@@ -14,7 +14,7 @@ CTextInputV1::CTextInputV1(SP<CZwpTextInputV1> resource_) : m_resource(resource_
m_resource->setActivate([this](CZwpTextInputV1* pMgr, wl_resource* seat, wl_resource* surface) {
if UNLIKELY (!surface) {
- LOGM(WARN, "Text-input-v1 PTI{:x}: No surface to activate text input on!", (uintptr_t)this);
+ LOGM(Log::WARN, "Text-input-v1 PTI{:x}: No surface to activate text input on!", (uintptr_t)this);
return;
}
@@ -103,10 +103,10 @@ void CTextInputV1Protocol::bindManager(wl_client* client, void* data, uint32_t v
RESOURCE->setOnDestroy([](CZwpTextInputManagerV1* pMgr) { PROTO::textInputV1->destroyResource(pMgr); });
RESOURCE->setCreateTextInput([this](CZwpTextInputManagerV1* pMgr, uint32_t id) {
const auto PTI = m_clients.emplace_back(makeShared<CTextInputV1>(makeShared<CZwpTextInputV1>(pMgr->client(), pMgr->version(), id)));
- LOGM(LOG, "New TI V1 at {:x}", (uintptr_t)PTI.get());
+ LOGM(Log::DEBUG, "New TI V1 at {:x}", (uintptr_t)PTI.get());
if UNLIKELY (!PTI->good()) {
- LOGM(ERR, "Could not alloc wl_resource for TIV1");
+ LOGM(Log::ERR, "Could not alloc wl_resource for TIV1");
pMgr->noMemory();
PROTO::textInputV1->destroyResource(PTI.get());
return;
diff --git a/src/protocols/TextInputV3.cpp b/src/protocols/TextInputV3.cpp
index 8a5ee478..595467c4 100644
--- a/src/protocols/TextInputV3.cpp
+++ b/src/protocols/TextInputV3.cpp
@@ -13,7 +13,7 @@ CTextInputV3::CTextInputV3(SP<CZwpTextInputV3> resource_) : m_resource(resource_
if UNLIKELY (!m_resource->resource())
return;
- LOGM(LOG, "New tiv3 at {:016x}", (uintptr_t)this);
+ LOGM(Log::DEBUG, "New tiv3 at {:016x}", (uintptr_t)this);
m_resource->setDestroy([this](CZwpTextInputV3* r) { PROTO::textInputV3->destroyTextInput(this); });
m_resource->setOnDestroy([this](CZwpTextInputV3* r) { PROTO::textInputV3->destroyTextInput(this); });
@@ -132,7 +132,7 @@ void CTextInputV3Protocol::onGetTextInput(CZwpTextInputManagerV3* pMgr, uint32_t
if UNLIKELY (!RESOURCE->good()) {
pMgr->noMemory();
m_textInputs.pop_back();
- LOGM(ERR, "Failed to create a tiv3 resource");
+ LOGM(Log::ERR, "Failed to create a tiv3 resource");
return;
}
diff --git a/src/protocols/ToplevelExport.cpp b/src/protocols/ToplevelExport.cpp
index 9d9d16be..9c9c1e1e 100644
--- a/src/protocols/ToplevelExport.cpp
+++ b/src/protocols/ToplevelExport.cpp
@@ -38,7 +38,7 @@ void CToplevelExportClient::captureToplevel(CHyprlandToplevelExportManagerV1* pM
makeShared<CToplevelExportFrame>(makeShared<CHyprlandToplevelExportFrameV1>(m_resource->client(), m_resource->version(), frame), overlayCursor_, handle));
if UNLIKELY (!FRAME->good()) {
- LOGM(ERR, "Couldn't alloc frame for sharing! (no memory)");
+ LOGM(Log::ERR, "Couldn't alloc frame for sharing! (no memory)");
m_resource->noMemory();
PROTO::toplevelExport->destroyResource(FRAME.get());
return;
@@ -81,13 +81,13 @@ CToplevelExportFrame::CToplevelExportFrame(SP<CHyprlandToplevelExportFrameV1> re
m_cursorOverlayRequested = !!overlayCursor_;
if UNLIKELY (!m_window) {
- LOGM(ERR, "Client requested sharing of window handle {:x} which does not exist!", m_window);
+ LOGM(Log::ERR, "Client requested sharing of window handle {:x} which does not exist!", m_window);
m_resource->sendFailed();
return;
}
if UNLIKELY (!m_window->m_isMapped) {
- LOGM(ERR, "Client requested sharing of window handle {:x} which is not shareable!", m_window);
+ LOGM(Log::ERR, "Client requested sharing of window handle {:x} which is not shareable!", m_window);
m_resource->sendFailed();
return;
}
@@ -102,14 +102,14 @@ CToplevelExportFrame::CToplevelExportFrame(SP<CHyprlandToplevelExportFrameV1> re
m_shmFormat = g_pHyprOpenGL->getPreferredReadFormat(PMONITOR);
if UNLIKELY (m_shmFormat == DRM_FORMAT_INVALID) {
- LOGM(ERR, "No format supported by renderer in capture toplevel");
+ LOGM(Log::ERR, "No format supported by renderer in capture toplevel");
m_resource->sendFailed();
return;
}
const auto PSHMINFO = NFormatUtils::getPixelFormatFromDRM(m_shmFormat);
if UNLIKELY (!PSHMINFO) {
- LOGM(ERR, "No pixel format supported by renderer in capture toplevel");
+ LOGM(Log::ERR, "No pixel format supported by renderer in capture toplevel");
m_resource->sendFailed();
return;
}
@@ -132,18 +132,18 @@ CToplevelExportFrame::CToplevelExportFrame(SP<CHyprlandToplevelExportFrameV1> re
void CToplevelExportFrame::copy(CHyprlandToplevelExportFrameV1* pFrame, wl_resource* buffer_, int32_t ignoreDamage) {
if UNLIKELY (!good()) {
- LOGM(ERR, "No frame in copyFrame??");
+ LOGM(Log::ERR, "No frame in copyFrame??");
return;
}
if UNLIKELY (!validMapped(m_window)) {
- LOGM(ERR, "Client requested sharing of window handle {:x} which is gone!", m_window);
+ LOGM(Log::ERR, "Client requested sharing of window handle {:x} which is gone!", m_window);
m_resource->sendFailed();
return;
}
if UNLIKELY (!m_window->m_isMapped) {
- LOGM(ERR, "Client requested sharing of window handle {:x} which is not shareable (2)!", m_window);
+ LOGM(Log::ERR, "Client requested sharing of window handle {:x} which is not shareable (2)!", m_window);
m_resource->sendFailed();
return;
}
@@ -393,7 +393,7 @@ void CToplevelExportProtocol::bindManager(wl_client* client, void* data, uint32_
const auto CLIENT = m_clients.emplace_back(makeShared<CToplevelExportClient>(makeShared<CHyprlandToplevelExportManagerV1>(client, ver, id)));
if (!CLIENT->good()) {
- LOGM(LOG, "Failed to bind client! (out of memory)");
+ LOGM(Log::DEBUG, "Failed to bind client! (out of memory)");
wl_client_post_no_memory(client);
m_clients.pop_back();
return;
@@ -401,7 +401,7 @@ void CToplevelExportProtocol::bindManager(wl_client* client, void* data, uint32_
CLIENT->m_self = CLIENT;
- LOGM(LOG, "Bound client successfully!");
+ LOGM(Log::DEBUG, "Bound client successfully!");
}
void CToplevelExportProtocol::destroyResource(CToplevelExportClient* client) {
diff --git a/src/protocols/ToplevelMapping.cpp b/src/protocols/ToplevelMapping.cpp
index 4cc822f0..823956df 100644
--- a/src/protocols/ToplevelMapping.cpp
+++ b/src/protocols/ToplevelMapping.cpp
@@ -17,7 +17,7 @@ CToplevelMappingManager::CToplevelMappingManager(SP<CHyprlandToplevelMappingMana
makeShared<CToplevelWindowMappingHandle>(makeShared<CHyprlandToplevelWindowMappingHandleV1>(m_resource->client(), m_resource->version(), handle)));
if UNLIKELY (!NEWHANDLE->m_resource->resource()) {
- LOGM(ERR, "Couldn't alloc mapping handle! (no memory)");
+ LOGM(Log::ERR, "Couldn't alloc mapping handle! (no memory)");
m_resource->noMemory();
return;
}
@@ -36,7 +36,7 @@ CToplevelMappingManager::CToplevelMappingManager(SP<CHyprlandToplevelMappingMana
makeShared<CToplevelWindowMappingHandle>(makeShared<CHyprlandToplevelWindowMappingHandleV1>(m_resource->client(), m_resource->version(), handle)));
if UNLIKELY (!NEWHANDLE->m_resource->resource()) {
- LOGM(ERR, "Couldn't alloc mapping handle! (no memory)");
+ LOGM(Log::ERR, "Couldn't alloc mapping handle! (no memory)");
m_resource->noMemory();
return;
}
@@ -62,7 +62,7 @@ void CToplevelMappingProtocol::bindManager(wl_client* client, void* data, uint32
const auto RESOURCE = m_managers.emplace_back(makeUnique<CToplevelMappingManager>(makeShared<CHyprlandToplevelMappingManagerV1>(client, ver, id))).get();
if UNLIKELY (!RESOURCE->good()) {
- LOGM(ERR, "Couldn't create a toplevel mapping manager");
+ LOGM(Log::ERR, "Couldn't create a toplevel mapping manager");
wl_client_post_no_memory(client);
m_managers.pop_back();
return;
diff --git a/src/protocols/VirtualKeyboard.cpp b/src/protocols/VirtualKeyboard.cpp
index 2acc2298..2f7e0bd1 100644
--- a/src/protocols/VirtualKeyboard.cpp
+++ b/src/protocols/VirtualKeyboard.cpp
@@ -75,14 +75,14 @@ CVirtualKeyboardV1Resource::CVirtualKeyboardV1Resource(SP<CZwpVirtualKeyboardV1>
auto xkbContext = xkb_context_new(XKB_CONTEXT_NO_FLAGS);
CFileDescriptor keymapFd{fd};
if UNLIKELY (!xkbContext) {
- LOGM(ERR, "xkbContext creation failed");
+ LOGM(Log::ERR, "xkbContext creation failed");
r->noMemory();
return;
}
auto keymapData = mmap(nullptr, len, PROT_READ, MAP_PRIVATE, keymapFd.get(), 0);
if UNLIKELY (keymapData == MAP_FAILED) {
- LOGM(ERR, "keymapData alloc failed");
+ LOGM(Log::ERR, "keymapData alloc failed");
xkb_context_unref(xkbContext);
r->noMemory();
return;
@@ -92,7 +92,7 @@ CVirtualKeyboardV1Resource::CVirtualKeyboardV1Resource(SP<CZwpVirtualKeyboardV1>
munmap(keymapData, len);
if UNLIKELY (!xkbKeymap) {
- LOGM(ERR, "xkbKeymap creation failed");
+ LOGM(Log::ERR, "xkbKeymap creation failed");
xkb_context_unref(xkbContext);
r->noMemory();
return;
@@ -171,7 +171,7 @@ void CVirtualKeyboardProtocol::onCreateKeeb(CZwpVirtualKeyboardManagerV1* pMgr,
return;
}
- LOGM(LOG, "New VKeyboard at id {}", id);
+ LOGM(Log::DEBUG, "New VKeyboard at id {}", id);
m_events.newKeyboard.emit(RESOURCE);
}
diff --git a/src/protocols/VirtualPointer.cpp b/src/protocols/VirtualPointer.cpp
index 9e258b7a..075f7cb9 100644
--- a/src/protocols/VirtualPointer.cpp
+++ b/src/protocols/VirtualPointer.cpp
@@ -145,7 +145,7 @@ void CVirtualPointerProtocol::onCreatePointer(CZwlrVirtualPointerManagerV1* pMgr
return;
}
- LOGM(LOG, "New VPointer at id {}", id);
+ LOGM(Log::DEBUG, "New VPointer at id {}", id);
m_events.newPointer.emit(RESOURCE);
}
diff --git a/src/protocols/WaylandProtocol.cpp b/src/protocols/WaylandProtocol.cpp
index 65099248..4cb4f991 100644
--- a/src/protocols/WaylandProtocol.cpp
+++ b/src/protocols/WaylandProtocol.cpp
@@ -24,7 +24,7 @@ IWaylandProtocol::IWaylandProtocol(const wl_interface* iface, const int& ver, co
m_name(name), m_global(wl_global_create(g_pCompositor->m_wlDisplay, iface, ver, this, &bindManagerInternal)) {
if UNLIKELY (!m_global) {
- LOGM(ERR, "could not create a global [{}]", m_name);
+ LOGM(Log::ERR, "could not create a global [{}]", m_name);
return;
}
@@ -33,7 +33,7 @@ IWaylandProtocol::IWaylandProtocol(const wl_interface* iface, const int& ver, co
m_liDisplayDestroy.parent = this;
wl_display_add_destroy_listener(g_pCompositor->m_wlDisplay, &m_liDisplayDestroy.listener);
- LOGM(LOG, "Registered global [{}]", m_name);
+ LOGM(Log::DEBUG, "Registered global [{}]", m_name);
}
IWaylandProtocol::~IWaylandProtocol() {
diff --git a/src/protocols/WaylandProtocol.hpp b/src/protocols/WaylandProtocol.hpp
index d46d6aaf..5f1c9798 100644
--- a/src/protocols/WaylandProtocol.hpp
+++ b/src/protocols/WaylandProtocol.hpp
@@ -4,6 +4,7 @@
#include "../helpers/memory/Memory.hpp"
#include <functional>
+#include <sstream>
#define RESOURCE_OR_BAIL(resname) \
const auto resname = (CWaylandResource*)wl_resource_get_user_data(resource); \
@@ -28,16 +29,16 @@
#define LOGM(level, ...) \
do { \
std::ostringstream oss; \
- if (level == WARN || level == ERR || level == CRIT) { \
+ if (level == Log::WARN || level == Log::ERR || level == Log::CRIT) { \
oss << "[" << __FILE__ << ":" << __LINE__ << "] "; \
- } else if (level == LOG || level == INFO || level == TRACE) { \
+ } else if (level == Log::DEBUG || level == Log::INFO || level == Log::TRACE) { \
oss << "[" << EXTRACT_CLASS_NAME() << "] "; \
} \
if constexpr (std::tuple_size<decltype(std::make_tuple(__VA_ARGS__))>::value == 1 && std::is_same_v<decltype(__VA_ARGS__), std::string>) { \
oss << __VA_ARGS__; \
- Debug::log(level, oss.str()); \
+ Log::logger->log(level, oss.str()); \
} else { \
- Debug::log(level, std::format("{}{}", oss.str(), std::format(__VA_ARGS__))); \
+ Log::logger->log(level, std::format("{}{}", oss.str(), std::format(__VA_ARGS__))); \
} \
} while (0)
diff --git a/src/protocols/XDGActivation.cpp b/src/protocols/XDGActivation.cpp
index f25ffca8..3d094fca 100644
--- a/src/protocols/XDGActivation.cpp
+++ b/src/protocols/XDGActivation.cpp
@@ -19,7 +19,7 @@ CXDGActivationToken::CXDGActivationToken(SP<CXdgActivationTokenV1> resource_) :
// TODO: should we send a protocol error of already_used here
// if it was used? the protocol spec doesn't say _when_ it should be sent...
if UNLIKELY (m_committed) {
- LOGM(WARN, "possible protocol error, two commits from one token. Ignoring.");
+ LOGM(Log::WARN, "possible protocol error, two commits from one token. Ignoring.");
return;
}
@@ -27,7 +27,7 @@ CXDGActivationToken::CXDGActivationToken(SP<CXdgActivationTokenV1> resource_) :
// send done with a new token
m_token = g_pTokenManager->registerNewToken({}, std::chrono::months{12});
- LOGM(LOG, "assigned new xdg-activation token {}", m_token);
+ LOGM(Log::DEBUG, "assigned new xdg-activation token {}", m_token);
m_resource->sendDone(m_token.c_str());
@@ -70,7 +70,7 @@ void CXDGActivationProtocol::bindManager(wl_client* client, void* data, uint32_t
auto TOKEN = std::ranges::find_if(m_sentTokens, [token](const auto& t) { return t.token == token; });
if UNLIKELY (TOKEN == m_sentTokens.end()) {
- LOGM(WARN, "activate event for non-existent token {}??", token);
+ LOGM(Log::WARN, "activate event for non-existent token {}??", token);
return;
}
@@ -81,7 +81,7 @@ void CXDGActivationProtocol::bindManager(wl_client* client, void* data, uint32_t
const auto PWINDOW = g_pCompositor->getWindowFromSurface(surf);
if UNLIKELY (!PWINDOW) {
- LOGM(WARN, "activate event for non-window or gone surface with token {}, ignoring", token);
+ LOGM(Log::WARN, "activate event for non-window or gone surface with token {}, ignoring", token);
return;
}
diff --git a/src/protocols/XDGDecoration.cpp b/src/protocols/XDGDecoration.cpp
index 0339db6b..e711ab3b 100644
--- a/src/protocols/XDGDecoration.cpp
+++ b/src/protocols/XDGDecoration.cpp
@@ -16,7 +16,7 @@ CXDGDecoration::CXDGDecoration(SP<CZxdgToplevelDecorationV1> resource_, wl_resou
default: modeString = "INVALID"; break;
}
- LOGM(LOG, "setMode: {}. {} MODE_SERVER_SIDE as reply.", modeString, (mode == ZXDG_TOPLEVEL_DECORATION_V1_MODE_SERVER_SIDE ? "Sending" : "Ignoring and sending"));
+ LOGM(Log::DEBUG, "setMode: {}. {} MODE_SERVER_SIDE as reply.", modeString, (mode == ZXDG_TOPLEVEL_DECORATION_V1_MODE_SERVER_SIDE ? "Sending" : "Ignoring and sending"));
auto sendMode = xdgModeOnRequestCSD(mode);
m_resource->sendConfigure(sendMode);
mostRecentlySent = sendMode;
@@ -24,7 +24,7 @@ CXDGDecoration::CXDGDecoration(SP<CZxdgToplevelDecorationV1> resource_, wl_resou
});
m_resource->setUnsetMode([this](CZxdgToplevelDecorationV1*) {
- LOGM(LOG, "unsetMode. Sending MODE_SERVER_SIDE.");
+ LOGM(Log::DEBUG, "unsetMode. Sending MODE_SERVER_SIDE.");
auto sendMode = xdgModeOnReleaseCSD();
m_resource->sendConfigure(sendMode);
mostRecentlySent = sendMode;
diff --git a/src/protocols/XDGOutput.cpp b/src/protocols/XDGOutput.cpp
index ccb78e98..8835d4b5 100644
--- a/src/protocols/XDGOutput.cpp
+++ b/src/protocols/XDGOutput.cpp
@@ -25,7 +25,7 @@ void CXDGOutputProtocol::bindManager(wl_client* client, void* data, uint32_t ver
const auto RESOURCE = m_managerResources.emplace_back(makeUnique<CZxdgOutputManagerV1>(client, ver, id)).get();
if UNLIKELY (!RESOURCE->resource()) {
- LOGM(LOG, "Couldn't bind XDGOutputMgr");
+ LOGM(Log::DEBUG, "Couldn't bind XDGOutputMgr");
wl_client_post_no_memory(client);
return;
}
@@ -61,11 +61,11 @@ void CXDGOutputProtocol::onManagerGetXDGOutput(CZxdgOutputManagerV1* mgr, uint32
}
if UNLIKELY (!PMONITOR) {
- LOGM(ERR, "New xdg_output from client {:x} ({}) has no CMonitor?!", (uintptr_t)CLIENT, pXDGOutput->m_isXWayland ? "xwayland" : "not xwayland");
+ LOGM(Log::ERR, "New xdg_output from client {:x} ({}) has no CMonitor?!", (uintptr_t)CLIENT, pXDGOutput->m_isXWayland ? "xwayland" : "not xwayland");
return;
}
- LOGM(LOG, "New xdg_output for {}: client {:x} ({})", PMONITOR->m_name, (uintptr_t)CLIENT, pXDGOutput->m_isXWayland ? "xwayland" : "not xwayland");
+ LOGM(Log::DEBUG, "New xdg_output for {}: client {:x} ({})", PMONITOR->m_name, (uintptr_t)CLIENT, pXDGOutput->m_isXWayland ? "xwayland" : "not xwayland");
const auto XDGVER = pXDGOutput->m_resource->version();
@@ -82,7 +82,7 @@ void CXDGOutputProtocol::onManagerGetXDGOutput(CZxdgOutputManagerV1* mgr, uint32
}
void CXDGOutputProtocol::updateAllOutputs() {
- LOGM(LOG, "updating all xdg_output heads");
+ LOGM(Log::DEBUG, "updating all xdg_output heads");
for (auto const& o : m_xdgOutputs) {
if (!o->m_monitor)
diff --git a/src/protocols/XDGShell.cpp b/src/protocols/XDGShell.cpp
index cbac46b5..4271dc53 100644
--- a/src/protocols/XDGShell.cpp
+++ b/src/protocols/XDGShell.cpp
@@ -48,7 +48,7 @@ CXDGPopupResource::CXDGPopupResource(SP<CXdgPopup> resource_, SP<CXDGSurfaceReso
});
m_resource->setReposition([this](CXdgPopup* r, wl_resource* positionerRes, uint32_t token) {
- LOGM(LOG, "Popup {:x} asks for reposition", (uintptr_t)this);
+ LOGM(Log::DEBUG, "Popup {:x} asks for reposition", (uintptr_t)this);
m_lastRepositionToken = token;
auto pos = CXDGPositionerResource::fromResource(positionerRes);
if (!pos)
@@ -58,7 +58,7 @@ CXDGPopupResource::CXDGPopupResource(SP<CXdgPopup> resource_, SP<CXDGSurfaceReso
});
m_resource->setGrab([this](CXdgPopup* r, wl_resource* seat, uint32_t serial) {
- LOGM(LOG, "xdg_popup {:x} requests grab", (uintptr_t)this);
+ LOGM(Log::DEBUG, "xdg_popup {:x} requests grab", (uintptr_t)this);
PROTO::xdgShell->addOrStartGrab(m_self.lock());
});
@@ -76,7 +76,7 @@ void CXDGPopupResource::applyPositioning(const CBox& box, const Vector2D& t1coor
m_geometry = m_positionerRules.getPosition(constraint, accumulateParentOffset() + t1coord);
- LOGM(LOG, "Popup {:x} gets unconstrained to {} {}", (uintptr_t)this, m_geometry.pos(), m_geometry.size());
+ LOGM(Log::DEBUG, "Popup {:x} gets unconstrained to {} {}", (uintptr_t)this, m_geometry.pos(), m_geometry.size());
configure(m_geometry);
@@ -122,7 +122,7 @@ void CXDGPopupResource::repositioned() {
if LIKELY (!m_lastRepositionToken)
return;
- LOGM(LOG, "repositioned: sending reposition token {}", m_lastRepositionToken);
+ LOGM(Log::DEBUG, "repositioned: sending reposition token {}", m_lastRepositionToken);
m_resource->sendRepositioned(m_lastRepositionToken);
m_lastRepositionToken = 0;
@@ -257,7 +257,7 @@ CXDGToplevelResource::CXDGToplevelResource(SP<CXdgToplevel> resource_, SP<CXDGSu
if (m_parent)
m_parent->m_children.emplace_back(m_self);
- LOGM(LOG, "Toplevel {:x} sets parent to {:x}{}", (uintptr_t)this, (uintptr_t)newp.get(), (oldParent ? std::format(" (was {:x})", (uintptr_t)oldParent.get()) : ""));
+ LOGM(Log::DEBUG, "Toplevel {:x} sets parent to {:x}{}", (uintptr_t)this, (uintptr_t)newp.get(), (oldParent ? std::format(" (was {:x})", (uintptr_t)oldParent.get()) : ""));
});
}
@@ -402,7 +402,7 @@ CXDGSurfaceResource::CXDGSurfaceResource(SP<CXdgSurface> resource_, SP<CXDGWMBas
});
m_listeners.surfaceDestroy = m_surface->m_events.destroy.listen([this] {
- LOGM(WARN, "wl_surface destroyed before its xdg_surface role object");
+ LOGM(Log::WARN, "wl_surface destroyed before its xdg_surface role object");
m_listeners.surfaceDestroy.reset();
m_listeners.surfaceCommit.reset();
@@ -458,7 +458,7 @@ CXDGSurfaceResource::CXDGSurfaceResource(SP<CXdgSurface> resource_, SP<CXDGWMBas
m_toplevel = RESOURCE;
m_toplevel->m_self = RESOURCE;
- LOGM(LOG, "xdg_surface {:x} gets a toplevel {:x}", (uintptr_t)m_owner.get(), (uintptr_t)RESOURCE.get());
+ LOGM(Log::DEBUG, "xdg_surface {:x} gets a toplevel {:x}", (uintptr_t)m_owner.get(), (uintptr_t)RESOURCE.get());
g_pCompositor->m_windows.emplace_back(Desktop::View::CWindow::create(m_self.lock()));
@@ -484,7 +484,7 @@ CXDGSurfaceResource::CXDGSurfaceResource(SP<CXdgSurface> resource_, SP<CXDGWMBas
m_popup = RESOURCE;
RESOURCE->m_self = RESOURCE;
- LOGM(LOG, "xdg_surface {:x} gets a popup {:x} owner {:x}", (uintptr_t)m_self.get(), (uintptr_t)RESOURCE.get(), (uintptr_t)parent.get());
+ LOGM(Log::DEBUG, "xdg_surface {:x} gets a popup {:x} owner {:x}", (uintptr_t)m_self.get(), (uintptr_t)RESOURCE.get(), (uintptr_t)parent.get());
if (!parent)
return;
@@ -502,7 +502,7 @@ CXDGSurfaceResource::CXDGSurfaceResource(SP<CXdgSurface> resource_, SP<CXDGWMBas
});
m_resource->setSetWindowGeometry([this](CXdgSurface* r, int32_t x, int32_t y, int32_t w, int32_t h) {
- LOGM(LOG, "xdg_surface {:x} requests geometry {}x{} {}x{}", (uintptr_t)this, x, y, w, h);
+ LOGM(Log::DEBUG, "xdg_surface {:x} requests geometry {}x{} {}x{}", (uintptr_t)this, x, y, w, h);
m_pending.geometry = {x, y, w, h};
});
}
@@ -596,7 +596,7 @@ CXDGPositionerRules::CXDGPositionerRules(SP<CXDGPositionerResource> positioner)
}
CBox CXDGPositionerRules::getPosition(CBox constraint, const Vector2D& parentCoord) {
- Debug::log(LOG, "GetPosition with constraint {} {} and parent {}", constraint.pos(), constraint.size(), parentCoord);
+ Log::logger->log(Log::DEBUG, "GetPosition with constraint {} {} and parent {}", constraint.pos(), constraint.size(), parentCoord);
// padding
constraint.expand(-4);
@@ -742,7 +742,7 @@ CXDGWMBase::CXDGWMBase(SP<CXdgWmBase> resource_) : m_resource(resource_) {
m_positioners.emplace_back(RESOURCE);
- LOGM(LOG, "New xdg_positioner at {:x}", (uintptr_t)RESOURCE.get());
+ LOGM(Log::DEBUG, "New xdg_positioner at {:x}", (uintptr_t)RESOURCE.get());
});
m_resource->setGetXdgSurface([this](CXdgWmBase* r, uint32_t id, wl_resource* surf) {
@@ -773,7 +773,7 @@ CXDGWMBase::CXDGWMBase(SP<CXdgWmBase> resource_) : m_resource(resource_) {
m_surfaces.emplace_back(RESOURCE);
- LOGM(LOG, "New xdg_surface at {:x}", (uintptr_t)RESOURCE.get());
+ LOGM(Log::DEBUG, "New xdg_surface at {:x}", (uintptr_t)RESOURCE.get());
});
m_resource->setPong([this](CXdgWmBase* r, uint32_t serial) {
@@ -817,7 +817,7 @@ void CXDGShellProtocol::bindManager(wl_client* client, void* data, uint32_t ver,
RESOURCE->m_self = RESOURCE;
- LOGM(LOG, "New xdg_wm_base at {:x}", (uintptr_t)RESOURCE.get());
+ LOGM(Log::DEBUG, "New xdg_wm_base at {:x}", (uintptr_t)RESOURCE.get());
}
void CXDGShellProtocol::destroyResource(CXDGWMBase* resource) {
diff --git a/src/protocols/XXColorManagement.cpp b/src/protocols/XXColorManagement.cpp
index 8ec780b4..92b30f7a 100644
--- a/src/protocols/XXColorManagement.cpp
+++ b/src/protocols/XXColorManagement.cpp
@@ -72,9 +72,9 @@ CXXColorManager::CXXColorManager(SP<CXxColorManagerV4> resource_) : m_resource(r
// resource->sendSupportedIntent(XX_COLOR_MANAGER_V4_RENDER_INTENT_ABSOLUTE);
// resource->sendSupportedIntent(XX_COLOR_MANAGER_V4_RENDER_INTENT_RELATIVE_BPC);
- m_resource->setDestroy([](CXxColorManagerV4* r) { LOGM(TRACE, "Destroy xx_color_manager at {:x} (generated default)", (uintptr_t)r); });
+ m_resource->setDestroy([](CXxColorManagerV4* r) { LOGM(Log::TRACE, "Destroy xx_color_manager at {:x} (generated default)", (uintptr_t)r); });
m_resource->setGetOutput([](CXxColorManagerV4* r, uint32_t id, wl_resource* output) {
- LOGM(TRACE, "Get output for id={}, output={}", id, (uintptr_t)output);
+ LOGM(Log::TRACE, "Get output for id={}, output={}", id, (uintptr_t)output);
const auto RESOURCE =
PROTO::xxColorManagement->m_outputs.emplace_back(makeShared<CXXColorManagementOutput>(makeShared<CXxColorManagementOutputV4>(r->client(), r->version(), id)));
@@ -87,11 +87,11 @@ CXXColorManager::CXXColorManager(SP<CXxColorManagerV4> resource_) : m_resource(r
RESOURCE->m_self = RESOURCE;
});
m_resource->setGetSurface([](CXxColorManagerV4* r, uint32_t id, wl_resource* surface) {
- LOGM(TRACE, "Get surface for id={}, surface={}", id, (uintptr_t)surface);
+ LOGM(Log::TRACE, "Get surface for id={}, surface={}", id, (uintptr_t)surface);
auto SURF = CWLSurfaceResource::fromResource(surface);
if (!SURF) {
- LOGM(ERR, "No surface for resource {}", (uintptr_t)surface);
+ LOGM(Log::ERR, "No surface for resource {}", (uintptr_t)surface);
r->error(-1, "Invalid surface (2)");
return;
}
@@ -112,11 +112,11 @@ CXXColorManager::CXXColorManager(SP<CXxColorManagerV4> resource_) : m_resource(r
RESOURCE->m_self = RESOURCE;
});
m_resource->setGetFeedbackSurface([](CXxColorManagerV4* r, uint32_t id, wl_resource* surface) {
- LOGM(TRACE, "Get feedback surface for id={}, surface={}", id, (uintptr_t)surface);
+ LOGM(Log::TRACE, "Get feedback surface for id={}, surface={}", id, (uintptr_t)surface);
auto SURF = CWLSurfaceResource::fromResource(surface);
if (!SURF) {
- LOGM(ERR, "No surface for resource {}", (uintptr_t)surface);
+ LOGM(Log::ERR, "No surface for resource {}", (uintptr_t)surface);
r->error(-1, "Invalid surface (2)");
return;
}
@@ -133,11 +133,11 @@ CXXColorManager::CXXColorManager(SP<CXxColorManagerV4> resource_) : m_resource(r
RESOURCE->m_self = RESOURCE;
});
m_resource->setNewIccCreator([](CXxColorManagerV4* r, uint32_t id) {
- LOGM(WARN, "New ICC creator for id={} (unsupported)", id);
+ LOGM(Log::WARN, "New ICC creator for id={} (unsupported)", id);
r->error(XX_COLOR_MANAGER_V4_ERROR_UNSUPPORTED_FEATURE, "ICC profiles are not supported");
});
m_resource->setNewParametricCreator([](CXxColorManagerV4* r, uint32_t id) {
- LOGM(TRACE, "New parametric creator for id={}", id);
+ LOGM(Log::TRACE, "New parametric creator for id={}", id);
const auto RESOURCE = PROTO::xxColorManagement->m_parametricCreators.emplace_back(
makeShared<CXXColorManagementParametricCreator>(makeShared<CXxImageDescriptionCreatorParamsV4>(r->client(), r->version(), id)));
@@ -168,7 +168,7 @@ CXXColorManagementOutput::CXXColorManagementOutput(SP<CXxColorManagementOutputV4
m_resource->setOnDestroy([this](CXxColorManagementOutputV4* r) { PROTO::xxColorManagement->destroyResource(this); });
m_resource->setGetImageDescription([this](CXxColorManagementOutputV4* r, uint32_t id) {
- LOGM(TRACE, "Get image description for output={}, id={}", (uintptr_t)r, id);
+ LOGM(Log::TRACE, "Get image description for output={}, id={}", (uintptr_t)r, id);
if (m_imageDescription.valid())
PROTO::xxColorManagement->destroyResource(m_imageDescription.get());
@@ -216,24 +216,24 @@ CXXColorManagementSurface::CXXColorManagementSurface(SP<CXxColorManagementSurfac
m_surface->m_colorManagement = RESOURCE;
m_resource->setOnDestroy([this](CXxColorManagementSurfaceV4* r) {
- LOGM(TRACE, "Destroy wp cm and xx cm for surface {}", (uintptr_t)m_surface);
+ LOGM(Log::TRACE, "Destroy wp cm and xx cm for surface {}", (uintptr_t)m_surface);
if (m_surface.valid())
PROTO::colorManagement->destroyResource(m_surface->m_colorManagement.get());
PROTO::xxColorManagement->destroyResource(this);
});
} else
m_resource->setOnDestroy([this](CXxColorManagementSurfaceV4* r) {
- LOGM(TRACE, "Destroy xx cm surface {}", (uintptr_t)m_surface);
+ LOGM(Log::TRACE, "Destroy xx cm surface {}", (uintptr_t)m_surface);
PROTO::xxColorManagement->destroyResource(this);
});
m_resource->setDestroy([this](CXxColorManagementSurfaceV4* r) {
- LOGM(TRACE, "Destroy xx cm surface {}", (uintptr_t)m_surface);
+ LOGM(Log::TRACE, "Destroy xx cm surface {}", (uintptr_t)m_surface);
PROTO::xxColorManagement->destroyResource(this);
});
m_resource->setSetImageDescription([this](CXxColorManagementSurfaceV4* r, wl_resource* image_description, uint32_t render_intent) {
- LOGM(TRACE, "Set image description for surface={}, desc={}, intent={}", (uintptr_t)r, (uintptr_t)image_description, render_intent);
+ LOGM(Log::TRACE, "Set image description for surface={}, desc={}, intent={}", (uintptr_t)r, (uintptr_t)image_description, render_intent);
const auto PO = sc<CXxImageDescriptionV4*>(wl_resource_get_user_data(image_description));
if (!PO) { // FIXME check validity
@@ -256,15 +256,15 @@ CXXColorManagementSurface::CXXColorManagementSurface(SP<CXxColorManagementSurfac
m_surface->m_colorManagement->m_imageDescription = imageDescription->get()->m_settings;
m_surface->m_colorManagement->setHasImageDescription(true);
} else
- LOGM(ERR, "Set image description for invalid surface");
+ LOGM(Log::ERR, "Set image description for invalid surface");
});
m_resource->setUnsetImageDescription([this](CXxColorManagementSurfaceV4* r) {
- LOGM(TRACE, "Unset image description for surface={}", (uintptr_t)r);
+ LOGM(Log::TRACE, "Unset image description for surface={}", (uintptr_t)r);
if (m_surface.valid()) {
m_surface->m_colorManagement->m_imageDescription = SImageDescription{};
m_surface->m_colorManagement->setHasImageDescription(false);
} else
- LOGM(ERR, "Unset image description for invalid surface");
+ LOGM(Log::ERR, "Unset image description for invalid surface");
});
}
@@ -278,7 +278,7 @@ wl_client* CXXColorManagementSurface::client() {
const SImageDescription& CXXColorManagementSurface::imageDescription() {
if (!hasImageDescription())
- LOGM(WARN, "Reading imageDescription while none set. Returns default or empty values");
+ LOGM(Log::WARN, "Reading imageDescription while none set. Returns default or empty values");
return m_imageDescription;
}
@@ -312,20 +312,20 @@ CXXColorManagementFeedbackSurface::CXXColorManagementFeedbackSurface(SP<CXxColor
m_client = m_resource->client();
m_resource->setDestroy([this](CXxColorManagementFeedbackSurfaceV4* r) {
- LOGM(TRACE, "Destroy xx cm feedback surface {}", (uintptr_t)m_surface);
+ LOGM(Log::TRACE, "Destroy xx cm feedback surface {}", (uintptr_t)m_surface);
if (m_currentPreferred.valid())
PROTO::xxColorManagement->destroyResource(m_currentPreferred.get());
PROTO::xxColorManagement->destroyResource(this);
});
m_resource->setOnDestroy([this](CXxColorManagementFeedbackSurfaceV4* r) {
- LOGM(TRACE, "Destroy xx cm feedback surface {}", (uintptr_t)m_surface);
+ LOGM(Log::TRACE, "Destroy xx cm feedback surface {}", (uintptr_t)m_surface);
if (m_currentPreferred.valid())
PROTO::xxColorManagement->destroyResource(m_currentPreferred.get());
PROTO::xxColorManagement->destroyResource(this);
});
m_resource->setGetPreferred([this](CXxColorManagementFeedbackSurfaceV4* r, uint32_t id) {
- LOGM(TRACE, "Get preferred for id {}", id);
+ LOGM(Log::TRACE, "Get preferred for id {}", id);
if (m_currentPreferred.valid())
PROTO::xxColorManagement->destroyResource(m_currentPreferred.get());
@@ -365,7 +365,7 @@ CXXColorManagementParametricCreator::CXXColorManagementParametricCreator(SP<CXxI
m_resource->setOnDestroy([this](CXxImageDescriptionCreatorParamsV4* r) { PROTO::xxColorManagement->destroyResource(this); });
m_resource->setCreate([this](CXxImageDescriptionCreatorParamsV4* r, uint32_t id) {
- LOGM(TRACE, "Create image description from params for id {}", id);
+ LOGM(Log::TRACE, "Create image description from params for id {}", id);
// FIXME actually check completeness
if (!m_valuesSet) {
@@ -401,7 +401,7 @@ CXXColorManagementParametricCreator::CXXColorManagementParametricCreator(SP<CXxI
PROTO::xxColorManagement->destroyResource(this);
});
m_resource->setSetTfNamed([this](CXxImageDescriptionCreatorParamsV4* r, uint32_t tf) {
- LOGM(TRACE, "Set image description transfer function to {}", tf);
+ LOGM(Log::TRACE, "Set image description transfer function to {}", tf);
if (m_valuesSet & PC_TF) {
r->error(XX_IMAGE_DESCRIPTION_CREATOR_PARAMS_V4_ERROR_ALREADY_SET, "Transfer function already set");
return;
@@ -429,7 +429,7 @@ CXXColorManagementParametricCreator::CXXColorManagementParametricCreator(SP<CXxI
m_valuesSet |= PC_TF;
});
m_resource->setSetTfPower([this](CXxImageDescriptionCreatorParamsV4* r, uint32_t eexp) {
- LOGM(TRACE, "Set image description tf power to {}", eexp);
+ LOGM(Log::TRACE, "Set image description tf power to {}", eexp);
if (m_valuesSet & PC_TF_POWER) {
r->error(XX_IMAGE_DESCRIPTION_CREATOR_PARAMS_V4_ERROR_ALREADY_SET, "Transfer function power already set");
return;
@@ -438,7 +438,7 @@ CXXColorManagementParametricCreator::CXXColorManagementParametricCreator(SP<CXxI
m_valuesSet |= PC_TF_POWER;
});
m_resource->setSetPrimariesNamed([this](CXxImageDescriptionCreatorParamsV4* r, uint32_t primaries) {
- LOGM(TRACE, "Set image description primaries by name {}", primaries);
+ LOGM(Log::TRACE, "Set image description primaries by name {}", primaries);
if (m_valuesSet & PC_PRIMARIES) {
r->error(XX_IMAGE_DESCRIPTION_CREATOR_PARAMS_V4_ERROR_ALREADY_SET, "Primaries already set");
return;
@@ -464,7 +464,7 @@ CXXColorManagementParametricCreator::CXXColorManagementParametricCreator(SP<CXxI
});
m_resource->setSetPrimaries(
[this](CXxImageDescriptionCreatorParamsV4* r, int32_t r_x, int32_t r_y, int32_t g_x, int32_t g_y, int32_t b_x, int32_t b_y, int32_t w_x, int32_t w_y) {
- LOGM(TRACE, "Set image description primaries by values r:{},{} g:{},{} b:{},{} w:{},{}", r_x, r_y, g_x, g_y, b_x, b_y, w_x, w_y);
+ LOGM(Log::TRACE, "Set image description primaries by values r:{},{} g:{},{} b:{},{} w:{},{}", r_x, r_y, g_x, g_y, b_x, b_y, w_x, w_y);
if (m_valuesSet & PC_PRIMARIES) {
r->error(XX_IMAGE_DESCRIPTION_CREATOR_PARAMS_V4_ERROR_ALREADY_SET, "Primaries already set");
return;
@@ -475,7 +475,7 @@ CXXColorManagementParametricCreator::CXXColorManagementParametricCreator(SP<CXxI
});
m_resource->setSetLuminances([this](CXxImageDescriptionCreatorParamsV4* r, uint32_t min_lum, uint32_t max_lum, uint32_t reference_lum) {
auto min = min_lum / 10000.0f;
- LOGM(TRACE, "Set image description luminances to {} - {} ({})", min, max_lum, reference_lum);
+ LOGM(Log::TRACE, "Set image description luminances to {} - {} ({})", min, max_lum, reference_lum);
if (m_valuesSet & PC_LUMINANCES) {
r->error(XX_IMAGE_DESCRIPTION_CREATOR_PARAMS_V4_ERROR_ALREADY_SET, "Luminances already set");
return;
@@ -489,7 +489,7 @@ CXXColorManagementParametricCreator::CXXColorManagementParametricCreator(SP<CXxI
});
m_resource->setSetMasteringDisplayPrimaries(
[this](CXxImageDescriptionCreatorParamsV4* r, int32_t r_x, int32_t r_y, int32_t g_x, int32_t g_y, int32_t b_x, int32_t b_y, int32_t w_x, int32_t w_y) {
- LOGM(TRACE, "Set image description mastering primaries by values r:{},{} g:{},{} b:{},{} w:{},{}", r_x, r_y, g_x, g_y, b_x, b_y, w_x, w_y);
+ LOGM(Log::TRACE, "Set image description mastering primaries by values r:{},{} g:{},{} b:{},{} w:{},{}", r_x, r_y, g_x, g_y, b_x, b_y, w_x, w_y);
// if (valuesSet & PC_MASTERING_PRIMARIES) {
// r->error(XX_IMAGE_DESCRIPTION_CREATOR_PARAMS_V4_ERROR_ALREADY_SET, "Mastering primaries already set");
// return;
@@ -499,7 +499,7 @@ CXXColorManagementParametricCreator::CXXColorManagementParametricCreator(SP<CXxI
});
m_resource->setSetMasteringLuminance([this](CXxImageDescriptionCreatorParamsV4* r, uint32_t min_lum, uint32_t max_lum) {
auto min = min_lum / 10000.0f;
- LOGM(TRACE, "Set image description mastering luminances to {} - {}", min, max_lum);
+ LOGM(Log::TRACE, "Set image description mastering luminances to {} - {}", min, max_lum);
// if (valuesSet & PC_MASTERING_LUMINANCES) {
// r->error(XX_IMAGE_DESCRIPTION_CREATOR_PARAMS_V4_ERROR_ALREADY_SET, "Mastering luminances already set");
// return;
@@ -512,7 +512,7 @@ CXXColorManagementParametricCreator::CXXColorManagementParametricCreator(SP<CXxI
m_valuesSet |= PC_MASTERING_LUMINANCES;
});
m_resource->setSetMaxCll([this](CXxImageDescriptionCreatorParamsV4* r, uint32_t max_cll) {
- LOGM(TRACE, "Set image description max content light level to {}", max_cll);
+ LOGM(Log::TRACE, "Set image description max content light level to {}", max_cll);
// if (valuesSet & PC_CLL) {
// r->error(XX_IMAGE_DESCRIPTION_CREATOR_PARAMS_V4_ERROR_ALREADY_SET, "Max CLL already set");
// return;
@@ -521,7 +521,7 @@ CXXColorManagementParametricCreator::CXXColorManagementParametricCreator(SP<CXxI
m_valuesSet |= PC_CLL;
});
m_resource->setSetMaxFall([this](CXxImageDescriptionCreatorParamsV4* r, uint32_t max_fall) {
- LOGM(TRACE, "Set image description max frame-average light level to {}", max_fall);
+ LOGM(Log::TRACE, "Set image description max frame-average light level to {}", max_fall);
// if (valuesSet & PC_FALL) {
// r->error(XX_IMAGE_DESCRIPTION_CREATOR_PARAMS_V4_ERROR_ALREADY_SET, "Max FALL already set");
// return;
@@ -550,7 +550,7 @@ CXXColorManagementImageDescription::CXXColorManagementImageDescription(SP<CXxIma
m_resource->setOnDestroy([this](CXxImageDescriptionV4* r) { PROTO::xxColorManagement->destroyResource(this); });
m_resource->setGetInformation([this](CXxImageDescriptionV4* r, uint32_t id) {
- LOGM(TRACE, "Get image information for image={}, id={}", (uintptr_t)r, id);
+ LOGM(Log::TRACE, "Get image information for image={}, id={}", (uintptr_t)r, id);
if (!m_allowGetInformation) {
r->error(XX_IMAGE_DESCRIPTION_V4_ERROR_NO_INFORMATION, "Image descriptions doesn't allow get_information request");
return;
@@ -632,7 +632,7 @@ void CXXColorManagementProtocol::bindManager(wl_client* client, void* data, uint
return;
}
- LOGM(TRACE, "New xx_color_manager at {:x}", (uintptr_t)RESOURCE.get());
+ LOGM(Log::TRACE, "New xx_color_manager at {:x}", (uintptr_t)RESOURCE.get());
}
void CXXColorManagementProtocol::onImagePreferredChanged() {
diff --git a/src/protocols/core/Compositor.cpp b/src/protocols/core/Compositor.cpp
index 2177c68f..dc4931a8 100644
--- a/src/protocols/core/Compositor.cpp
+++ b/src/protocols/core/Compositor.cpp
@@ -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());
});
}
diff --git a/src/protocols/core/DataDevice.cpp b/src/protocols/core/DataDevice.cpp
index 4a24e861..41f07273 100644
--- a/src/protocols/core/DataDevice.cpp
+++ b/src/protocols/core/DataDevice.cpp
@@ -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);
diff --git a/src/protocols/core/Output.cpp b/src/protocols/core/Output.cpp
index 61c4acf8..755470e4 100644
--- a/src/protocols/core/Output.cpp
+++ b/src/protocols/core/Output.cpp
@@ -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()));
diff --git a/src/protocols/core/Seat.cpp b/src/protocols/core/Seat.cpp
index 74e5615e..bfe70a75 100644
--- a/src/protocols/core/Seat.cpp
+++ b/src/protocols/core/Seat.cpp
@@ -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);
}
diff --git a/src/protocols/core/Shm.cpp b/src/protocols/core/Shm.cpp
index 43c087bc..476b58e3 100644
--- a/src/protocols/core/Shm.cpp
+++ b/src/protocols/core/Shm.cpp
@@ -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;
}
diff --git a/src/protocols/core/Subcompositor.cpp b/src/protocols/core/Subcompositor.cpp
index c198052c..14dc4666 100644
--- a/src/protocols/core/Subcompositor.cpp
+++ b/src/protocols/core/Subcompositor.cpp
@@ -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);
});
diff --git a/src/protocols/types/Buffer.cpp b/src/protocols/types/Buffer.cpp
index 86b37be0..ad19cb32 100644
--- a/src/protocols/types/Buffer.cpp
+++ b/src/protocols/types/Buffer.cpp
@@ -31,7 +31,7 @@ void IHLBuffer::onBackendRelease(const std::function<void()>& fn) {
if (m_hlEvents.backendRelease) {
if (m_backendReleaseQueuedFn)
m_backendReleaseQueuedFn();
- Debug::log(LOG, "backendRelease emitted early");
+ Log::logger->log(Log::DEBUG, "backendRelease emitted early");
}
m_backendReleaseQueuedFn = fn;
diff --git a/src/protocols/types/DMABuffer.cpp b/src/protocols/types/DMABuffer.cpp
index 7116aa40..f3c3e067 100644
--- a/src/protocols/types/DMABuffer.cpp
+++ b/src/protocols/types/DMABuffer.cpp
@@ -25,12 +25,12 @@ CDMABuffer::CDMABuffer(uint32_t id, wl_client* client, Aquamarine::SDMABUFAttrs
auto eglImage = g_pHyprOpenGL->createEGLImage(m_attrs);
if UNLIKELY (!eglImage) {
- Debug::log(ERR, "CDMABuffer: failed to import EGLImage, retrying as implicit");
+ Log::logger->log(Log::ERR, "CDMABuffer: failed to import EGLImage, retrying as implicit");
m_attrs.modifier = DRM_FORMAT_MOD_INVALID;
eglImage = g_pHyprOpenGL->createEGLImage(m_attrs);
if UNLIKELY (!eglImage) {
- Debug::log(ERR, "CDMABuffer: failed to import EGLImage");
+ Log::logger->log(Log::ERR, "CDMABuffer: failed to import EGLImage");
return;
}
}
@@ -40,7 +40,7 @@ CDMABuffer::CDMABuffer(uint32_t id, wl_client* client, Aquamarine::SDMABUFAttrs
m_success = m_texture->m_texID;
if UNLIKELY (!m_success)
- Debug::log(ERR, "Failed to create a dmabuf: texture is null");
+ Log::logger->log(Log::ERR, "Failed to create a dmabuf: texture is null");
}
CDMABuffer::~CDMABuffer() {
diff --git a/src/render/Framebuffer.cpp b/src/render/Framebuffer.cpp
index 070bcc1b..98947297 100644
--- a/src/render/Framebuffer.cpp
+++ b/src/render/Framebuffer.cpp
@@ -49,7 +49,7 @@ bool CFramebuffer::alloc(int w, int h, uint32_t drmFormat) {
auto status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
RASSERT((status == GL_FRAMEBUFFER_COMPLETE), "Framebuffer incomplete, couldn't create! (FB status: {}, GL Error: 0x{:x})", status, sc<int>(glGetError()));
- Debug::log(LOG, "Framebuffer created, status {}", status);
+ Log::logger->log(Log::DEBUG, "Framebuffer created, status {}", status);
}
glBindTexture(GL_TEXTURE_2D, 0);
diff --git a/src/render/OpenGL.cpp b/src/render/OpenGL.cpp
index 198ba0e4..6f61d667 100644
--- a/src/render/OpenGL.cpp
+++ b/src/render/OpenGL.cpp
@@ -24,6 +24,7 @@
#include "../managers/eventLoop/EventLoopManager.hpp"
#include "../managers/CursorManager.hpp"
#include "../helpers/fs/FsUtils.hpp"
+#include "../helpers/env/Env.hpp"
#include "../helpers/MainLoopExecutor.hpp"
#include "../i18n/Engine.hpp"
#include "debug/HyprNotificationOverlay.hpp"
@@ -36,6 +37,7 @@
#include "AsyncResourceGatherer.hpp"
#include <ranges>
#include <algorithm>
+#include <fstream>
#include <string>
#include <xf86drm.h>
#include <fcntl.h>
@@ -57,19 +59,19 @@ const std::vector<const char*> ASSET_PATHS = {
static inline void loadGLProc(void* pProc, const char* name) {
void* proc = rc<void*>(eglGetProcAddress(name));
if (proc == nullptr) {
- Debug::log(CRIT, "[Tracy GPU Profiling] eglGetProcAddress({}) failed", name);
+ Log::logger->log(Log::CRIT, "[Tracy GPU Profiling] eglGetProcAddress({}) failed", name);
abort();
}
*sc<void**>(pProc) = proc;
}
-static enum eLogLevel eglLogToLevel(EGLint type) {
+static enum Hyprutils::CLI::eLogLevel eglLogToLevel(EGLint type) {
switch (type) {
- case EGL_DEBUG_MSG_CRITICAL_KHR: return CRIT;
- case EGL_DEBUG_MSG_ERROR_KHR: return ERR;
- case EGL_DEBUG_MSG_WARN_KHR: return WARN;
- case EGL_DEBUG_MSG_INFO_KHR: return LOG;
- default: return LOG;
+ case EGL_DEBUG_MSG_CRITICAL_KHR: return Log::CRIT;
+ case EGL_DEBUG_MSG_ERROR_KHR: return Log::ERR;
+ case EGL_DEBUG_MSG_WARN_KHR: return Log::WARN;
+ case EGL_DEBUG_MSG_INFO_KHR: return Log::DEBUG;
+ default: return Log::DEBUG;
}
}
@@ -96,7 +98,7 @@ static const char* eglErrorToString(EGLint error) {
}
static void eglLog(EGLenum error, const char* command, EGLint type, EGLLabelKHR thread, EGLLabelKHR obj, const char* msg) {
- Debug::log(eglLogToLevel(type), "[EGL] Command {} errored out with {} (0x{}): {}", command, eglErrorToString(error), error, msg);
+ Log::logger->log(eglLogToLevel(type), "[EGL] Command {} errored out with {} (0x{}): {}", command, eglErrorToString(error), error, msg);
}
static int openRenderNode(int drmFd) {
@@ -106,14 +108,14 @@ static int openRenderNode(int drmFd) {
// primary node
renderName = drmGetPrimaryDeviceNameFromFd(drmFd);
if (!renderName) {
- Debug::log(ERR, "drmGetPrimaryDeviceNameFromFd failed");
+ Log::logger->log(Log::ERR, "drmGetPrimaryDeviceNameFromFd failed");
return -1;
}
- Debug::log(LOG, "DRM dev {} has no render node, falling back to primary", renderName);
+ Log::logger->log(Log::DEBUG, "DRM dev {} has no render node, falling back to primary", renderName);
drmVersion* render_version = drmGetVersion(drmFd);
if (render_version && render_version->name) {
- Debug::log(LOG, "DRM dev versionName", render_version->name);
+ Log::logger->log(Log::DEBUG, "DRM dev versionName", render_version->name);
if (strcmp(render_version->name, "evdi") == 0) {
free(renderName); // NOLINT(cppcoreguidelines-no-malloc)
renderName = strdup("/dev/dri/card0");
@@ -122,11 +124,11 @@ static int openRenderNode(int drmFd) {
}
}
- Debug::log(LOG, "openRenderNode got drm device {}", renderName);
+ Log::logger->log(Log::DEBUG, "openRenderNode got drm device {}", renderName);
int renderFD = open(renderName, O_RDWR | O_CLOEXEC);
if (renderFD < 0)
- Debug::log(ERR, "openRenderNode failed to open drm device {}", renderName);
+ Log::logger->log(Log::ERR, "openRenderNode failed to open drm device {}", renderName);
free(renderName); // NOLINT(cppcoreguidelines-no-malloc)
return renderFD;
@@ -159,13 +161,13 @@ void CHyprOpenGLImpl::initEGL(bool gbm) {
m_exts.EXT_image_dma_buf_import_modifiers = EGLEXTENSIONS.contains("EXT_image_dma_buf_import_modifiers");
if (m_exts.IMG_context_priority) {
- Debug::log(LOG, "EGL: IMG_context_priority supported, requesting high");
+ Log::logger->log(Log::DEBUG, "EGL: IMG_context_priority supported, requesting high");
attrs.push_back(EGL_CONTEXT_PRIORITY_LEVEL_IMG);
attrs.push_back(EGL_CONTEXT_PRIORITY_HIGH_IMG);
}
if (m_exts.EXT_create_context_robustness) {
- Debug::log(LOG, "EGL: EXT_create_context_robustness supported, requesting lose on reset");
+ Log::logger->log(Log::DEBUG, "EGL: EXT_create_context_robustness supported, requesting lose on reset");
attrs.push_back(EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_EXT);
attrs.push_back(EGL_LOSE_CONTEXT_ON_RESET_EXT);
}
@@ -180,7 +182,7 @@ void CHyprOpenGLImpl::initEGL(bool gbm) {
m_eglContext = eglCreateContext(m_eglDisplay, EGL_NO_CONFIG_KHR, EGL_NO_CONTEXT, attrs.data());
if (m_eglContext == EGL_NO_CONTEXT) {
- Debug::log(WARN, "EGL: Failed to create a context with GLES3.2, retrying 3.0");
+ Log::logger->log(Log::WARN, "EGL: Failed to create a context with GLES3.2, retrying 3.0");
attrs = attrsNoVer;
attrs.push_back(EGL_CONTEXT_MAJOR_VERSION);
@@ -200,9 +202,9 @@ void CHyprOpenGLImpl::initEGL(bool gbm) {
EGLint priority = EGL_CONTEXT_PRIORITY_MEDIUM_IMG;
eglQueryContext(m_eglDisplay, m_eglContext, EGL_CONTEXT_PRIORITY_LEVEL_IMG, &priority);
if (priority != EGL_CONTEXT_PRIORITY_HIGH_IMG)
- Debug::log(ERR, "EGL: Failed to obtain a high priority context");
+ Log::logger->log(Log::ERR, "EGL: Failed to obtain a high priority context");
else
- Debug::log(LOG, "EGL: Got a high priority context");
+ Log::logger->log(Log::DEBUG, "EGL: Got a high priority context");
}
eglMakeCurrent(m_eglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, m_eglContext);
@@ -222,12 +224,12 @@ static bool drmDeviceHasName(const drmDevice* device, const std::string& name) {
EGLDeviceEXT CHyprOpenGLImpl::eglDeviceFromDRMFD(int drmFD) {
EGLint nDevices = 0;
if (!m_proc.eglQueryDevicesEXT(0, nullptr, &nDevices)) {
- Debug::log(ERR, "eglDeviceFromDRMFD: eglQueryDevicesEXT failed");
+ Log::logger->log(Log::ERR, "eglDeviceFromDRMFD: eglQueryDevicesEXT failed");
return EGL_NO_DEVICE_EXT;
}
if (nDevices <= 0) {
- Debug::log(ERR, "eglDeviceFromDRMFD: no devices");
+ Log::logger->log(Log::ERR, "eglDeviceFromDRMFD: no devices");
return EGL_NO_DEVICE_EXT;
}
@@ -235,13 +237,13 @@ EGLDeviceEXT CHyprOpenGLImpl::eglDeviceFromDRMFD(int drmFD) {
devices.resize(nDevices);
if (!m_proc.eglQueryDevicesEXT(nDevices, devices.data(), &nDevices)) {
- Debug::log(ERR, "eglDeviceFromDRMFD: eglQueryDevicesEXT failed (2)");
+ Log::logger->log(Log::ERR, "eglDeviceFromDRMFD: eglQueryDevicesEXT failed (2)");
return EGL_NO_DEVICE_EXT;
}
drmDevice* drmDev = nullptr;
if (int ret = drmGetDevice(drmFD, &drmDev); ret < 0) {
- Debug::log(ERR, "eglDeviceFromDRMFD: drmGetDevice failed");
+ Log::logger->log(Log::ERR, "eglDeviceFromDRMFD: drmGetDevice failed");
return EGL_NO_DEVICE_EXT;
}
@@ -251,21 +253,21 @@ EGLDeviceEXT CHyprOpenGLImpl::eglDeviceFromDRMFD(int drmFD) {
continue;
if (drmDeviceHasName(drmDev, devName)) {
- Debug::log(LOG, "eglDeviceFromDRMFD: Using device {}", devName);
+ Log::logger->log(Log::DEBUG, "eglDeviceFromDRMFD: Using device {}", devName);
drmFreeDevice(&drmDev);
return d;
}
}
drmFreeDevice(&drmDev);
- Debug::log(LOG, "eglDeviceFromDRMFD: No drm devices found");
+ Log::logger->log(Log::DEBUG, "eglDeviceFromDRMFD: No drm devices found");
return EGL_NO_DEVICE_EXT;
}
CHyprOpenGLImpl::CHyprOpenGLImpl() : m_drmFD(g_pCompositor->m_drmRenderNode.fd >= 0 ? g_pCompositor->m_drmRenderNode.fd : g_pCompositor->m_drm.fd) {
const std::string EGLEXTENSIONS = eglQueryString(EGL_NO_DISPLAY, EGL_EXTENSIONS);
- Debug::log(LOG, "Supported EGL global extensions: ({}) {}", std::ranges::count(EGLEXTENSIONS, ' '), EGLEXTENSIONS);
+ Log::logger->log(Log::DEBUG, "Supported EGL global extensions: ({}) {}", std::ranges::count(EGLEXTENSIONS, ' '), EGLEXTENSIONS);
m_exts.KHR_display_reference = EGLEXTENSIONS.contains("KHR_display_reference");
@@ -315,7 +317,7 @@ CHyprOpenGLImpl::CHyprOpenGLImpl() : m_drmFD(g_pCompositor->m_drmRenderNode.fd >
}
if (!success) {
- Debug::log(WARN, "EGL: EXT_platform_device or EGL_EXT_device_query not supported, using gbm");
+ Log::logger->log(Log::WARN, "EGL: EXT_platform_device or EGL_EXT_device_query not supported, using gbm");
if (EGLEXTENSIONS.contains("KHR_platform_gbm")) {
success = true;
m_gbmFD = CFileDescriptor{openRenderNode(m_drmFD)};
@@ -337,33 +339,33 @@ CHyprOpenGLImpl::CHyprOpenGLImpl() : m_drmFD(g_pCompositor->m_drmRenderNode.fd >
m_extensions = EXTENSIONS;
- Debug::log(LOG, "Creating the Hypr OpenGL Renderer!");
- Debug::log(LOG, "Using: {}", rc<const char*>(glGetString(GL_VERSION)));
- Debug::log(LOG, "Vendor: {}", rc<const char*>(glGetString(GL_VENDOR)));
- Debug::log(LOG, "Renderer: {}", rc<const char*>(glGetString(GL_RENDERER)));
- Debug::log(LOG, "Supported extensions: ({}) {}", std::ranges::count(m_extensions, ' '), m_extensions);
+ Log::logger->log(Log::DEBUG, "Creating the Hypr OpenGL Renderer!");
+ Log::logger->log(Log::DEBUG, "Using: {}", rc<const char*>(glGetString(GL_VERSION)));
+ Log::logger->log(Log::DEBUG, "Vendor: {}", rc<const char*>(glGetString(GL_VENDOR)));
+ Log::logger->log(Log::DEBUG, "Renderer: {}", rc<const char*>(glGetString(GL_RENDERER)));
+ Log::logger->log(Log::DEBUG, "Supported extensions: ({}) {}", std::ranges::count(m_extensions, ' '), m_extensions);
m_exts.EXT_read_format_bgra = m_extensions.contains("GL_EXT_read_format_bgra");
RASSERT(m_extensions.contains("GL_EXT_texture_format_BGRA8888"), "GL_EXT_texture_format_BGRA8888 support by the GPU driver is required");
if (!m_exts.EXT_read_format_bgra)
- Debug::log(WARN, "Your GPU does not support GL_EXT_read_format_bgra, this may cause issues with texture importing");
+ Log::logger->log(Log::WARN, "Your GPU does not support GL_EXT_read_format_bgra, this may cause issues with texture importing");
if (!m_exts.EXT_image_dma_buf_import || !m_exts.EXT_image_dma_buf_import_modifiers)
- Debug::log(WARN, "Your GPU does not support DMABUFs, this will possibly cause issues and will take a hit on the performance.");
+ Log::logger->log(Log::WARN, "Your GPU does not support DMABUFs, this will possibly cause issues and will take a hit on the performance.");
const std::string EGLEXTENSIONS_DISPLAY = eglQueryString(m_eglDisplay, EGL_EXTENSIONS);
- Debug::log(LOG, "Supported EGL display extensions: ({}) {}", std::ranges::count(EGLEXTENSIONS_DISPLAY, ' '), EGLEXTENSIONS_DISPLAY);
+ Log::logger->log(Log::DEBUG, "Supported EGL display extensions: ({}) {}", std::ranges::count(EGLEXTENSIONS_DISPLAY, ' '), EGLEXTENSIONS_DISPLAY);
#if defined(__linux__)
m_exts.EGL_ANDROID_native_fence_sync_ext = EGLEXTENSIONS_DISPLAY.contains("EGL_ANDROID_native_fence_sync");
if (!m_exts.EGL_ANDROID_native_fence_sync_ext)
- Debug::log(WARN, "Your GPU does not support explicit sync via the EGL_ANDROID_native_fence_sync extension.");
+ Log::logger->log(Log::WARN, "Your GPU does not support explicit sync via the EGL_ANDROID_native_fence_sync extension.");
#else
m_exts.EGL_ANDROID_native_fence_sync_ext = false;
- Debug::log(WARN, "Forcefully disabling explicit sync: BSD is missing support for proper timeline export");
+ Log::logger->log(Log::WARN, "Forcefully disabling explicit sync: BSD is missing support for proper timeline export");
#endif
#ifdef USE_TRACY_GPU
@@ -454,7 +456,7 @@ std::optional<std::vector<uint64_t>> CHyprOpenGLImpl::getModsForFormat(EGLint fo
EGLint len = 0;
if (!m_proc.eglQueryDmaBufModifiersEXT(m_eglDisplay, format, 0, nullptr, nullptr, &len)) {
- Debug::log(ERR, "EGL: Failed to query mods");
+ Log::logger->log(Log::ERR, "EGL: Failed to query mods");
return std::nullopt;
}
@@ -492,12 +494,12 @@ std::optional<std::vector<uint64_t>> CHyprOpenGLImpl::getModsForFormat(EGLint fo
}
void CHyprOpenGLImpl::initDRMFormats() {
- const auto DISABLE_MODS = envEnabled("HYPRLAND_EGL_NO_MODIFIERS");
+ const auto DISABLE_MODS = Env::envEnabled("HYPRLAND_EGL_NO_MODIFIERS");
if (DISABLE_MODS)
- Debug::log(WARN, "HYPRLAND_EGL_NO_MODIFIERS set, disabling modifiers");
+ Log::logger->log(Log::WARN, "HYPRLAND_EGL_NO_MODIFIERS set, disabling modifiers");
if (!m_exts.EXT_image_dma_buf_import) {
- Debug::log(ERR, "EGL: No dmabuf import, DMABufs will not work.");
+ Log::logger->log(Log::ERR, "EGL: No dmabuf import, DMABufs will not work.");
return;
}
@@ -506,7 +508,7 @@ void CHyprOpenGLImpl::initDRMFormats() {
if (!m_exts.EXT_image_dma_buf_import_modifiers || !m_proc.eglQueryDmaBufFormatsEXT) {
formats.push_back(DRM_FORMAT_ARGB8888);
formats.push_back(DRM_FORMAT_XRGB8888);
- Debug::log(WARN, "EGL: No mod support");
+ Log::logger->log(Log::WARN, "EGL: No mod support");
} else {
EGLint len = 0;
m_proc.eglQueryDmaBufFormatsEXT(m_eglDisplay, 0, nullptr, &len);
@@ -515,11 +517,11 @@ void CHyprOpenGLImpl::initDRMFormats() {
}
if (formats.empty()) {
- Debug::log(ERR, "EGL: Failed to get formats, DMABufs will not work.");
+ Log::logger->log(Log::ERR, "EGL: Failed to get formats, DMABufs will not work.");
return;
}
- Debug::log(LOG, "Supported DMA-BUF formats:");
+ Log::logger->log(Log::DEBUG, "Supported DMA-BUF formats:");
std::vector<SDRMFormat> dmaFormats;
// reserve number of elements to avoid reallocations
@@ -551,7 +553,7 @@ void CHyprOpenGLImpl::initDRMFormats() {
modifierData.reserve(mods.size());
auto fmtName = drmGetFormatName(fmt);
- Debug::log(LOG, "EGL: GPU Supports Format {} (0x{:x})", fmtName ? fmtName : "?unknown?", fmt);
+ Log::logger->log(Log::DEBUG, "EGL: GPU Supports Format {} (0x{:x})", fmtName ? fmtName : "?unknown?", fmt);
for (auto const& mod : mods) {
auto modName = drmGetFormatModifierName(mod);
modifierData.emplace_back(std::make_pair<>(mod, modName ? modName : "?unknown?"));
@@ -569,16 +571,16 @@ void CHyprOpenGLImpl::initDRMFormats() {
});
for (auto const& [m, name] : modifierData) {
- Debug::log(LOG, "EGL: | with modifier {} (0x{:x})", name, m);
+ Log::logger->log(Log::DEBUG, "EGL: | with modifier {} (0x{:x})", name, m);
mods.emplace_back(m);
}
}
- Debug::log(LOG, "EGL: {} formats found in total. Some modifiers may be omitted as they are external-only.", dmaFormats.size());
+ Log::logger->log(Log::DEBUG, "EGL: {} formats found in total. Some modifiers may be omitted as they are external-only.", dmaFormats.size());
if (dmaFormats.empty())
- Debug::log(WARN,
- "EGL: WARNING: No dmabuf formats were found, dmabuf will be disabled. This will degrade performance, but is most likely a driver issue or a very old GPU.");
+ Log::logger->log(
+ Log::WARN, "EGL: WARNING: No dmabuf formats were found, dmabuf will be disabled. This will degrade performance, but is most likely a driver issue or a very old GPU.");
m_drmFormats = dmaFormats;
}
@@ -630,7 +632,7 @@ EGLImageKHR CHyprOpenGLImpl::createEGLImage(const Aquamarine::SDMABUFAttrs& attr
EGLImageKHR image = m_proc.eglCreateImageKHR(m_eglDisplay, EGL_NO_CONTEXT, EGL_LINUX_DMA_BUF_EXT, nullptr, attribs.data());
if (image == EGL_NO_IMAGE_KHR) {
- Debug::log(ERR, "EGL: EGLCreateImageKHR failed: {}", eglGetError());
+ Log::logger->log(Log::ERR, "EGL: EGLCreateImageKHR failed: {}", eglGetError());
return EGL_NO_IMAGE_KHR;
}
@@ -653,7 +655,7 @@ void CHyprOpenGLImpl::logShaderError(const GLuint& shader, bool program, bool si
const auto FULLERROR = (program ? "Screen shader parser: Error linking program:" : "Screen shader parser: Error compiling shader: ") + errorStr;
- Debug::log(ERR, "Failed to link shader: {}", FULLERROR);
+ Log::logger->log(Log::ERR, "Failed to link shader: {}", FULLERROR);
if (!silent)
g_pConfigManager->addParseError(FULLERROR);
@@ -1020,9 +1022,10 @@ bool CHyprOpenGLImpl::initShaders() {
shaders->m_shCM.uniformLocations[SHADER_USE_ALPHA_MATTE] = glGetUniformLocation(prog, "useAlphaMatte");
shaders->m_shCM.createVao();
} else
- Debug::log(ERR,
- "WARNING: CM Shader failed compiling, color management will not work. It's likely because your GPU is an old piece of garbage, don't file bug reports "
- "about this!");
+ Log::logger->log(
+ Log::ERR,
+ "WARNING: CM Shader failed compiling, color management will not work. It's likely because your GPU is an old piece of garbage, don't file bug reports "
+ "about this!");
}
const auto FRAGSHADOW = processShader("shadow.frag", includes);
@@ -1238,14 +1241,14 @@ bool CHyprOpenGLImpl::initShaders() {
if (!m_shadersInitialized)
throw e;
- Debug::log(ERR, "Shaders update failed: {}", e.what());
+ Log::logger->log(Log::ERR, "Shaders update failed: {}", e.what());
return false;
}
m_shaders = shaders;
m_shadersInitialized = true;
- Debug::log(LOG, "Shaders initialized successfully.");
+ Log::logger->log(Log::DEBUG, "Shaders initialized successfully.");
return true;
}
@@ -1967,7 +1970,7 @@ void CHyprOpenGLImpl::renderTextureMatte(SP<CTexture> tex, const CBox& box, CFra
// Dual (or more) kawase blur
CFramebuffer* CHyprOpenGLImpl::blurMainFramebufferWithDamage(float a, CRegion* originalDamage) {
if (!m_renderData.currentFB->getTexture()) {
- Debug::log(ERR, "BUG THIS: null fb texture while attempting to blur main fb?! (introspection off?!)");
+ Log::logger->log(Log::ERR, "BUG THIS: null fb texture while attempting to blur main fb?! (introspection off?!)");
return &m_renderData.pCurrentMonData->mirrorFB; // return something to sample from at least
}
@@ -2809,12 +2812,12 @@ std::string CHyprOpenGLImpl::resolveAssetPath(const std::string& filename) {
fullPath = p;
break;
} else
- Debug::log(LOG, "resolveAssetPath: looking at {} unsuccessful: ec {}", filename, ec.message());
+ Log::logger->log(Log::DEBUG, "resolveAssetPath: looking at {} unsuccessful: ec {}", filename, ec.message());
}
if (fullPath.empty()) {
m_failedAssetsNo++;
- Debug::log(ERR, "resolveAssetPath: looking for {} failed (no provider found)", filename);
+ Log::logger->log(Log::ERR, "resolveAssetPath: looking for {} failed (no provider found)", filename);
return "";
}
@@ -2832,7 +2835,7 @@ SP<CTexture> CHyprOpenGLImpl::loadAsset(const std::string& filename) {
if (!CAIROSURFACE) {
m_failedAssetsNo++;
- Debug::log(ERR, "loadAsset: failed to load {} (corrupt / inaccessible / not png)", fullPath);
+ Log::logger->log(Log::ERR, "loadAsset: failed to load {} (corrupt / inaccessible / not png)", fullPath);
return m_missingAssetTexture;
}
@@ -3084,7 +3087,7 @@ void CHyprOpenGLImpl::requestBackgroundResource() {
void CHyprOpenGLImpl::createBGTextureForMonitor(PHLMONITOR pMonitor) {
RASSERT(m_renderData.pMonitor, "Tried to createBGTex without begin()!");
- Debug::log(LOG, "Creating a texture for BGTex");
+ Log::logger->log(Log::DEBUG, "Creating a texture for BGTex");
static auto PRENDERTEX = CConfigValue<Hyprlang::INT>("misc:disable_hyprland_logo");
static auto PNOSPLASH = CConfigValue<Hyprlang::INT>("misc:disable_splash_rendering");
@@ -3180,7 +3183,7 @@ void CHyprOpenGLImpl::createBGTextureForMonitor(PHLMONITOR pMonitor) {
if (m_renderData.currentFB)
m_renderData.currentFB->bind();
- Debug::log(LOG, "Background created for monitor {}", pMonitor->m_name);
+ Log::logger->log(Log::DEBUG, "Background created for monitor {}", pMonitor->m_name);
// clear the resource after we're done using it
g_pEventLoopManager->doLater([this] { m_backgroundResource.reset(); });
@@ -3237,7 +3240,7 @@ void CHyprOpenGLImpl::destroyMonitorResources(PHLMONITORREF pMonitor) {
}
if (pMonitor)
- Debug::log(LOG, "Monitor {} -> destroyed all render data", pMonitor->m_name);
+ Log::logger->log(Log::DEBUG, "Monitor {} -> destroyed all render data", pMonitor->m_name);
}
void CHyprOpenGLImpl::saveMatrix() {
@@ -3373,7 +3376,7 @@ void SRenderModifData::applyToBox(CBox& box) {
box.y = OLDPOS.y * COS + OLDPOS.x * SIN;
}
}
- } catch (std::bad_any_cast& e) { Debug::log(ERR, "BUG THIS OR PLUGIN ERROR: caught a bad_any_cast in SRenderModifData::applyToBox!"); }
+ } catch (std::bad_any_cast& e) { Log::logger->log(Log::ERR, "BUG THIS OR PLUGIN ERROR: caught a bad_any_cast in SRenderModifData::applyToBox!"); }
}
}
@@ -3390,7 +3393,7 @@ void SRenderModifData::applyToRegion(CRegion& rg) {
case RMOD_TYPE_ROTATE: /* TODO */
case RMOD_TYPE_ROTATECENTER: break;
}
- } catch (std::bad_any_cast& e) { Debug::log(ERR, "BUG THIS OR PLUGIN ERROR: caught a bad_any_cast in SRenderModifData::applyToRegion!"); }
+ } catch (std::bad_any_cast& e) { Log::logger->log(Log::ERR, "BUG THIS OR PLUGIN ERROR: caught a bad_any_cast in SRenderModifData::applyToRegion!"); }
}
}
@@ -3408,7 +3411,7 @@ float SRenderModifData::combinedScale() {
case RMOD_TYPE_ROTATE:
case RMOD_TYPE_ROTATECENTER: break;
}
- } catch (std::bad_any_cast& e) { Debug::log(ERR, "BUG THIS OR PLUGIN ERROR: caught a bad_any_cast in SRenderModifData::combinedScale!"); }
+ } catch (std::bad_any_cast& e) { Log::logger->log(Log::ERR, "BUG THIS OR PLUGIN ERROR: caught a bad_any_cast in SRenderModifData::combinedScale!"); }
}
return scale;
}
@@ -3419,7 +3422,7 @@ UP<CEGLSync> CEGLSync::create() {
EGLSyncKHR sync = g_pHyprOpenGL->m_proc.eglCreateSyncKHR(g_pHyprOpenGL->m_eglDisplay, EGL_SYNC_NATIVE_FENCE_ANDROID, nullptr);
if (sync == EGL_NO_SYNC_KHR) {
- Debug::log(ERR, "eglCreateSyncKHR failed");
+ Log::logger->log(Log::ERR, "eglCreateSyncKHR failed");
return nullptr;
}
@@ -3428,7 +3431,7 @@ UP<CEGLSync> CEGLSync::create() {
int fd = g_pHyprOpenGL->m_proc.eglDupNativeFenceFDANDROID(g_pHyprOpenGL->m_eglDisplay, sync);
if (fd == EGL_NO_NATIVE_FENCE_FD_ANDROID) {
- Debug::log(ERR, "eglDupNativeFenceFDANDROID failed");
+ Log::logger->log(Log::ERR, "eglDupNativeFenceFDANDROID failed");
return nullptr;
}
@@ -3445,7 +3448,7 @@ CEGLSync::~CEGLSync() {
return;
if (g_pHyprOpenGL && g_pHyprOpenGL->m_proc.eglDestroySyncKHR(g_pHyprOpenGL->m_eglDisplay, m_sync) != EGL_TRUE)
- Debug::log(ERR, "eglDestroySyncKHR failed");
+ Log::logger->log(Log::ERR, "eglDestroySyncKHR failed");
}
CFileDescriptor& CEGLSync::fd() {
diff --git a/src/render/Renderbuffer.cpp b/src/render/Renderbuffer.cpp
index d47a5195..d7a77b74 100644
--- a/src/render/Renderbuffer.cpp
+++ b/src/render/Renderbuffer.cpp
@@ -26,7 +26,7 @@ CRenderbuffer::CRenderbuffer(SP<Aquamarine::IBuffer> buffer, uint32_t format) :
m_image = g_pHyprOpenGL->createEGLImage(dma);
if (m_image == EGL_NO_IMAGE_KHR) {
- Debug::log(ERR, "rb: createEGLImage failed");
+ Log::logger->log(Log::ERR, "rb: createEGLImage failed");
return;
}
@@ -42,7 +42,7 @@ CRenderbuffer::CRenderbuffer(SP<Aquamarine::IBuffer> buffer, uint32_t format) :
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, m_rbo);
if (glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE) {
- Debug::log(ERR, "rbo: glCheckFramebufferStatus failed");
+ Log::logger->log(Log::ERR, "rbo: glCheckFramebufferStatus failed");
return;
}
diff --git a/src/render/Renderer.cpp b/src/render/Renderer.cpp
index b75dd1e0..40b6cc89 100644
--- a/src/render/Renderer.cpp
+++ b/src/render/Renderer.cpp
@@ -36,7 +36,7 @@
#include "pass/RectPassElement.hpp"
#include "pass/RendererHintsPassElement.hpp"
#include "pass/SurfacePassElement.hpp"
-#include "debug/Log.hpp"
+#include "debug/log/Logger.hpp"
#include "../protocols/ColorManagement.hpp"
#include "../protocols/types/ContentType.hpp"
#include "../helpers/MiscFunctions.hpp"
@@ -76,14 +76,14 @@ CHyprRenderer::CHyprRenderer() {
else if (name.contains("softpipe") || name.contains("Software Rasterizer") || name.contains("llvmpipe"))
m_software = true;
- Debug::log(LOG, "DRM driver information: {} v{}.{}.{} from {} description {}", name, DRMV->version_major, DRMV->version_minor, DRMV->version_patchlevel,
- std::string{DRMV->date, DRMV->date_len}, std::string{DRMV->desc, DRMV->desc_len});
+ Log::logger->log(Log::DEBUG, "DRM driver information: {} v{}.{}.{} from {} description {}", name, DRMV->version_major, DRMV->version_minor, DRMV->version_patchlevel,
+ std::string{DRMV->date, DRMV->date_len}, std::string{DRMV->desc, DRMV->desc_len});
drmFreeVersion(DRMV);
}
m_mgpu = drmDevices > 1;
} else {
- Debug::log(LOG, "Aq backend has no session, omitting full DRM node checks");
+ Log::logger->log(Log::DEBUG, "Aq backend has no session, omitting full DRM node checks");
const auto DRMV = drmGetVersion(g_pCompositor->m_drm.fd);
@@ -98,17 +98,17 @@ CHyprRenderer::CHyprRenderer() {
else if (name.contains("softpipe") || name.contains("Software Rasterizer") || name.contains("llvmpipe"))
m_software = true;
- Debug::log(LOG, "Primary DRM driver information: {} v{}.{}.{} from {} description {}", name, DRMV->version_major, DRMV->version_minor, DRMV->version_patchlevel,
- std::string{DRMV->date, DRMV->date_len}, std::string{DRMV->desc, DRMV->desc_len});
+ Log::logger->log(Log::DEBUG, "Primary DRM driver information: {} v{}.{}.{} from {} description {}", name, DRMV->version_major, DRMV->version_minor,
+ DRMV->version_patchlevel, std::string{DRMV->date, DRMV->date_len}, std::string{DRMV->desc, DRMV->desc_len});
} else {
- Debug::log(LOG, "No primary DRM driver information found");
+ Log::logger->log(Log::DEBUG, "No primary DRM driver information found");
}
drmFreeVersion(DRMV);
}
if (m_nvidia)
- Debug::log(WARN, "NVIDIA detected, please remember to follow nvidia instructions on the wiki");
+ Log::logger->log(Log::WARN, "NVIDIA detected, please remember to follow nvidia instructions on the wiki");
// cursor hiding stuff
@@ -1273,7 +1273,7 @@ void CHyprRenderer::renderMonitor(PHLMONITOR pMonitor, bool commit) {
const float ZOOMFACTOR = pMonitor->m_cursorZoom->value();
if (pMonitor->m_pixelSize.x < 1 || pMonitor->m_pixelSize.y < 1) {
- Debug::log(ERR, "Refusing to render a monitor because of an invalid pixel size: {}", pMonitor->m_pixelSize);
+ Log::logger->log(Log::ERR, "Refusing to render a monitor because of an invalid pixel size: {}", pMonitor->m_pixelSize);
return;
}
@@ -1314,7 +1314,7 @@ void CHyprRenderer::renderMonitor(PHLMONITOR pMonitor, bool commit) {
if (pMonitor->attemptDirectScanout()) {
return;
} else if (!pMonitor->m_lastScanout.expired()) {
- Debug::log(LOG, "Left a direct scanout.");
+ Log::logger->log(Log::DEBUG, "Left a direct scanout.");
pMonitor->m_lastScanout.reset();
// reset DRM format, but only if needed since it might modeset
@@ -1335,7 +1335,7 @@ void CHyprRenderer::renderMonitor(PHLMONITOR pMonitor, bool commit) {
return;
if (*PDAMAGETRACKINGMODE == -1) {
- Debug::log(CRIT, "Damage tracking mode -1 ????");
+ Log::logger->log(Log::CRIT, "Damage tracking mode -1 ????");
return;
}
@@ -1373,7 +1373,7 @@ void CHyprRenderer::renderMonitor(PHLMONITOR pMonitor, bool commit) {
CRegion damage, finalDamage;
if (!beginRender(pMonitor, damage, RENDER_MODE_NORMAL)) {
- Debug::log(ERR, "renderer: couldn't beginRender()!");
+ Log::logger->log(Log::ERR, "renderer: couldn't beginRender()!");
return;
}
@@ -1529,9 +1529,9 @@ static hdr_output_metadata createHDRMetadata(SImageDescription settings, S
auto luminances = settings.masteringLuminances.max > 0 ? settings.masteringLuminances :
SImageDescription::SPCMasteringLuminances{.min = monitor->minLuminance(), .max = monitor->maxLuminance(10000)};
- Debug::log(TRACE, "ColorManagement primaries {},{} {},{} {},{} {},{}", colorimetry.red.x, colorimetry.red.y, colorimetry.green.x, colorimetry.green.y, colorimetry.blue.x,
- colorimetry.blue.y, colorimetry.white.x, colorimetry.white.y);
- Debug::log(TRACE, "ColorManagement min {}, max {}, cll {}, fall {}", luminances.min, luminances.max, settings.maxCLL, settings.maxFALL);
+ Log::logger->log(Log::TRACE, "ColorManagement primaries {},{} {},{} {},{} {},{}", colorimetry.red.x, colorimetry.red.y, colorimetry.green.x, colorimetry.green.y,
+ colorimetry.blue.x, colorimetry.blue.y, colorimetry.white.x, colorimetry.white.y);
+ Log::logger->log(Log::TRACE, "ColorManagement min {}, max {}, cll {}, fall {}", luminances.min, luminances.max, settings.maxCLL, settings.maxFALL);
return hdr_output_metadata{
.metadata_type = 0,
.hdmi_metadata_type1 =
@@ -1589,11 +1589,11 @@ bool CHyprRenderer::commitPendingAndDoExplicitSync(PHLMONITOR pMonitor) {
// passthrough
bool needsHdrMetadataUpdate = SURF->m_colorManagement->needsHdrMetadataUpdate() || pMonitor->m_previousFSWindow != FS_WINDOW || pMonitor->m_needsHDRupdate;
if (SURF->m_colorManagement->needsHdrMetadataUpdate()) {
- Debug::log(INFO, "[CM] Recreating HDR metadata for surface");
+ Log::logger->log(Log::INFO, "[CM] Recreating HDR metadata for surface");
SURF->m_colorManagement->setHDRMetadata(createHDRMetadata(SURF->m_colorManagement->imageDescription(), pMonitor));
}
if (needsHdrMetadataUpdate) {
- Debug::log(INFO, "[CM] Updating HDR metadata from surface");
+ Log::logger->log(Log::INFO, "[CM] Updating HDR metadata from surface");
pMonitor->m_output->state->setHDRMetadata(SURF->m_colorManagement->hdrMetadata());
}
hdrIsHandled = true;
@@ -1610,11 +1610,11 @@ bool CHyprRenderer::commitPendingAndDoExplicitSync(PHLMONITOR pMonitor) {
// FIXME ok for now, will need some other logic if monitor image description can be modified some other way
const auto targetCM = wantHDR ? (*PAUTOHDR == 2 ? NCMType::CM_HDR_EDID : NCMType::CM_HDR) : pMonitor->m_cmType;
const auto targetSDREOTF = pMonitor->m_sdrEotf;
- Debug::log(INFO, "[CM] Auto HDR: changing monitor cm to {}", sc<uint8_t>(targetCM));
+ Log::logger->log(Log::INFO, "[CM] Auto HDR: changing monitor cm to {}", sc<uint8_t>(targetCM));
pMonitor->applyCMType(targetCM, targetSDREOTF);
pMonitor->m_previousFSWindow.reset(); // trigger CTM update
}
- Debug::log(INFO, wantHDR ? "[CM] Updating HDR metadata from monitor" : "[CM] Restoring SDR mode");
+ Log::logger->log(Log::INFO, wantHDR ? "[CM] Updating HDR metadata from monitor" : "[CM] Restoring SDR mode");
pMonitor->m_output->state->setHDRMetadata(wantHDR ? createHDRMetadata(pMonitor->m_imageDescription, pMonitor) : NO_HDR_METADATA);
}
pMonitor->m_needsHDRupdate = true;
@@ -1623,12 +1623,12 @@ bool CHyprRenderer::commitPendingAndDoExplicitSync(PHLMONITOR pMonitor) {
const bool needsWCG = pMonitor->wantsWideColor();
if (pMonitor->m_output->state->state().wideColorGamut != needsWCG) {
- Debug::log(TRACE, "Setting wide color gamut {}", needsWCG ? "on" : "off");
+ Log::logger->log(Log::TRACE, "Setting wide color gamut {}", needsWCG ? "on" : "off");
pMonitor->m_output->state->setWideColorGamut(needsWCG);
// FIXME do not trust enabled10bit, auto switch to 10bit and back if needed
if (needsWCG && !pMonitor->m_enabled10bit) {
- Debug::log(WARN, "Wide color gamut is enabled but the display is not in 10bit mode");
+ Log::logger->log(Log::WARN, "Wide color gamut is enabled but the display is not in 10bit mode");
static bool shown = false;
if (!shown) {
g_pHyprNotificationOverlay->addNotification(I18n::i18nEngine()->localize(I18n::TXT_KEY_NOTIF_WIDE_COLOR_NOT_10B, {{"name", pMonitor->m_name}}), CHyprColor{}, 15000,
@@ -1645,14 +1645,14 @@ bool CHyprRenderer::commitPendingAndDoExplicitSync(PHLMONITOR pMonitor) {
if (*PNONSHADER == CM_NS_IGNORE || !FS_WINDOW || !pMonitor->needsCM() || !pMonitor->canNoShaderCM() ||
(*PNONSHADER == CM_NS_ONDEMAND && pMonitor->m_lastScanout.expired() && *PPASS != 1)) {
if (pMonitor->m_noShaderCTM) {
- Debug::log(INFO, "[CM] No fullscreen CTM, restoring previous one");
+ Log::logger->log(Log::INFO, "[CM] No fullscreen CTM, restoring previous one");
pMonitor->m_noShaderCTM = false;
pMonitor->m_ctmUpdated = true;
}
} else {
const auto FS_DESC = pMonitor->getFSImageDescription();
if (FS_DESC.has_value()) {
- Debug::log(INFO, "[CM] Updating fullscreen CTM");
+ Log::logger->log(Log::INFO, "[CM] Updating fullscreen CTM");
pMonitor->m_noShaderCTM = true;
const auto mat = FS_DESC->getPrimaries().convertMatrix(pMonitor->m_imageDescription.getPrimaries()).mat();
const std::array<float, 9> CTM = {
@@ -1675,13 +1675,13 @@ bool CHyprRenderer::commitPendingAndDoExplicitSync(PHLMONITOR pMonitor) {
bool ok = pMonitor->m_state.commit();
if (!ok) {
if (pMonitor->m_inFence.isValid()) {
- Debug::log(TRACE, "Monitor state commit failed, retrying without a fence");
+ Log::logger->log(Log::TRACE, "Monitor state commit failed, retrying without a fence");
pMonitor->m_output->state->resetExplicitFences();
ok = pMonitor->m_state.commit();
}
if (!ok) {
- Debug::log(TRACE, "Monitor state commit failed");
+ Log::logger->log(Log::TRACE, "Monitor state commit failed");
// rollback the buffer to avoid writing to the front buffer that is being
// displayed
pMonitor->m_output->swapchain->rollback();
@@ -1699,7 +1699,7 @@ void CHyprRenderer::renderWorkspace(PHLMONITOR pMonitor, PHLWORKSPACE pWorkspace
TRACY_GPU_ZONE("RenderWorkspace");
if (!DELTALESSTHAN(sc<double>(geometry.width) / sc<double>(geometry.height), pMonitor->m_pixelSize.x / pMonitor->m_pixelSize.y, 0.01)) {
- Debug::log(ERR, "Ignoring geometry in renderWorkspace: aspect ratio mismatch");
+ Log::logger->log(Log::ERR, "Ignoring geometry in renderWorkspace: aspect ratio mismatch");
scale = 1.f;
translate = Vector2D{};
}
@@ -1852,7 +1852,7 @@ void CHyprRenderer::arrangeLayerArray(PHLMONITOR pMonitor, const std::vector<PHL
box.y -= PSTATE->margin.bottom;
if (box.width <= 0 || box.height <= 0) {
- Debug::log(ERR, "LayerSurface {:x} has a negative/zero w/h???", rc<uintptr_t>(ls.get()));
+ Log::logger->log(Log::ERR, "LayerSurface {:x} has a negative/zero w/h???", rc<uintptr_t>(ls.get()));
continue;
}
@@ -1911,7 +1911,7 @@ void CHyprRenderer::damageSurface(SP<CWLSurfaceResource> pSurface, double x, dou
const auto WLSURF = Desktop::View::CWLSurface::fromResource(pSurface);
CRegion damageBox = WLSURF ? WLSURF->computeDamage() : CRegion{};
if (!WLSURF) {
- Debug::log(ERR, "BUG THIS: No CWLSurface for surface in damageSurface!!!");
+ Log::logger->log(Log::ERR, "BUG THIS: No CWLSurface for surface in damageSurface!!!");
return;
}
@@ -1941,8 +1941,8 @@ void CHyprRenderer::damageSurface(SP<CWLSurfaceResource> pSurface, double x, dou
static auto PLOGDAMAGE = CConfigValue<Hyprlang::INT>("debug:log_damage");
if (*PLOGDAMAGE)
- Debug::log(LOG, "Damage: Surface (extents): xy: {}, {} wh: {}, {}", damageBox.pixman()->extents.x1, damageBox.pixman()->extents.y1,
- damageBox.pixman()->extents.x2 - damageBox.pixman()->extents.x1, damageBox.pixman()->extents.y2 - damageBox.pixman()->extents.y1);
+ Log::logger->log(Log::DEBUG, "Damage: Surface (extents): xy: {}, {} wh: {}, {}", damageBox.pixman()->extents.x1, damageBox.pixman()->extents.y1,
+ damageBox.pixman()->extents.x2 - damageBox.pixman()->extents.x1, damageBox.pixman()->extents.y2 - damageBox.pixman()->extents.y1);
}
void CHyprRenderer::damageWindow(PHLWINDOW pWindow, bool forceFull) {
@@ -1969,7 +1969,7 @@ void CHyprRenderer::damageWindow(PHLWINDOW pWindow, bool forceFull) {
static auto PLOGDAMAGE = CConfigValue<Hyprlang::INT>("debug:log_damage");
if (*PLOGDAMAGE)
- Debug::log(LOG, "Damage: Window ({}): xy: {}, {} wh: {}, {}", pWindow->m_title, windowBox.x, windowBox.y, windowBox.width, windowBox.height);
+ Log::logger->log(Log::DEBUG, "Damage: Window ({}): xy: {}, {} wh: {}, {}", pWindow->m_title, windowBox.x, windowBox.y, windowBox.width, windowBox.height);
}
void CHyprRenderer::damageMonitor(PHLMONITOR pMonitor) {
@@ -1982,7 +1982,7 @@ void CHyprRenderer::damageMonitor(PHLMONITOR pMonitor) {
static auto PLOGDAMAGE = CConfigValue<Hyprlang::INT>("debug:log_damage");
if (*PLOGDAMAGE)
- Debug::log(LOG, "Damage: Monitor {}", pMonitor->m_name);
+ Log::logger->log(Log::DEBUG, "Damage: Monitor {}", pMonitor->m_name);
}
void CHyprRenderer::damageBox(const CBox& box, bool skipFrameSchedule) {
@@ -2002,7 +2002,7 @@ void CHyprRenderer::damageBox(const CBox& box, bool skipFrameSchedule) {
static auto PLOGDAMAGE = CConfigValue<Hyprlang::INT>("debug:log_damage");
if (*PLOGDAMAGE)
- Debug::log(LOG, "Damage: Box: xy: {}, {} wh: {}, {}", box.x, box.y, box.w, box.h);
+ Log::logger->log(Log::DEBUG, "Damage: Box: xy: {}, {} wh: {}, {}", box.x, box.y, box.w, box.h);
}
void CHyprRenderer::damageBox(const int& x, const int& y, const int& w, const int& h) {
@@ -2131,7 +2131,7 @@ void CHyprRenderer::ensureCursorRenderingMode() {
return;
if (HIDE) {
- Debug::log(LOG, "Hiding the cursor (hl-mandated)");
+ Log::logger->log(Log::DEBUG, "Hiding the cursor (hl-mandated)");
for (auto const& m : g_pCompositor->m_monitors) {
if (!g_pPointerManager->softwareLockedFor(m))
@@ -2143,7 +2143,7 @@ void CHyprRenderer::ensureCursorRenderingMode() {
setCursorHidden(true);
} else {
- Debug::log(LOG, "Showing the cursor (hl-mandated)");
+ Log::logger->log(Log::DEBUG, "Showing the cursor (hl-mandated)");
for (auto const& m : g_pCompositor->m_monitors) {
if (!g_pPointerManager->softwareLockedFor(m))
@@ -2284,7 +2284,7 @@ bool CHyprRenderer::beginRender(PHLMONITOR pMonitor, CRegion& damage, eRenderMod
if (!buffer) {
m_currentBuffer = pMonitor->m_output->swapchain->next(&bufferAge);
if (!m_currentBuffer) {
- Debug::log(ERR, "Failed to acquire swapchain buffer for {}", pMonitor->m_name);
+ Log::logger->log(Log::ERR, "Failed to acquire swapchain buffer for {}", pMonitor->m_name);
return false;
}
} else
@@ -2293,12 +2293,12 @@ bool CHyprRenderer::beginRender(PHLMONITOR pMonitor, CRegion& damage, eRenderMod
try {
m_currentRenderbuffer = getOrCreateRenderbuffer(m_currentBuffer, pMonitor->m_output->state->state().drmFormat);
} catch (std::exception& e) {
- Debug::log(ERR, "getOrCreateRenderbuffer failed for {}", pMonitor->m_name);
+ Log::logger->log(Log::ERR, "getOrCreateRenderbuffer failed for {}", pMonitor->m_name);
return false;
}
if (!m_currentRenderbuffer) {
- Debug::log(ERR, "failed to start a render pass for output {}, no RBO could be obtained", pMonitor->m_name);
+ Log::logger->log(Log::ERR, "failed to start a render pass for output {}, no RBO could be obtained", pMonitor->m_name);
return false;
}
@@ -2344,7 +2344,7 @@ void CHyprRenderer::endRender(const std::function<void()>& renderingDoneCallback
PMONITOR->m_output->state->setBuffer(m_currentBuffer);
if (!g_pHyprOpenGL->explicitSyncSupported()) {
- Debug::log(TRACE, "renderer: Explicit sync unsupported, falling back to implicit in endRender");
+ Log::logger->log(Log::TRACE, "renderer: Explicit sync unsupported, falling back to implicit in endRender");
// nvidia doesn't have implicit sync, so we have to explicitly wait here, llvmpipe and other software renderer seems to bug out aswell.
if ((isNvidia() && *PNVIDIAANTIFLICKER) || isSoftware())
@@ -2383,7 +2383,7 @@ void CHyprRenderer::endRender(const std::function<void()>& renderingDoneCallback
PMONITOR->m_output->state->setExplicitInFence(PMONITOR->m_inFence.get());
}
} else {
- Debug::log(ERR, "renderer: Explicit sync failed, releasing resources");
+ Log::logger->log(Log::ERR, "renderer: Explicit sync failed, releasing resources");
m_usedAsyncBuffers.clear(); // release all buffer refs and hope implicit sync works
if (renderingDoneCallback)
@@ -2437,7 +2437,7 @@ void CHyprRenderer::makeSnapshot(PHLWINDOW pWindow) {
if (!shouldRenderWindow(pWindow))
return; // ignore, window is not being rendered
- Debug::log(LOG, "renderer: making a snapshot of {:x}", rc<uintptr_t>(pWindow.get()));
+ Log::logger->log(Log::DEBUG, "renderer: making a snapshot of {:x}", rc<uintptr_t>(pWindow.get()));
// we need to "damage" the entire monitor
// so that we render the entire window
@@ -2472,7 +2472,7 @@ void CHyprRenderer::makeSnapshot(PHLLS pLayer) {
if (!PMONITOR || !PMONITOR->m_output || PMONITOR->m_pixelSize.x <= 0 || PMONITOR->m_pixelSize.y <= 0)
return;
- Debug::log(LOG, "renderer: making a snapshot of {:x}", rc<uintptr_t>(pLayer.get()));
+ Log::logger->log(Log::DEBUG, "renderer: making a snapshot of {:x}", rc<uintptr_t>(pLayer.get()));
// we need to "damage" the entire monitor
// so that we render the entire window
@@ -2509,7 +2509,7 @@ void CHyprRenderer::makeSnapshot(WP<Desktop::View::CPopup> popup) {
if (!popup->aliveAndVisible())
return;
- Debug::log(LOG, "renderer: making a snapshot of {:x}", rc<uintptr_t>(popup.get()));
+ Log::logger->log(Log::DEBUG, "renderer: making a snapshot of {:x}", rc<uintptr_t>(popup.get()));
CRegion fakeDamage{0, 0, PMONITOR->m_transformedSize.x, PMONITOR->m_transformedSize.y};
diff --git a/src/render/Texture.cpp b/src/render/Texture.cpp
index 17c416c7..f1704afa 100644
--- a/src/render/Texture.cpp
+++ b/src/render/Texture.cpp
@@ -36,7 +36,7 @@ CTexture::CTexture(const SP<Aquamarine::IBuffer> buffer, bool keepDataCopy) : m_
auto shm = buffer->shm();
if (!shm.success) {
- Debug::log(ERR, "Cannot create a texture: buffer has no dmabuf or shm");
+ Log::logger->log(Log::ERR, "Cannot create a texture: buffer has no dmabuf or shm");
return;
}
@@ -51,7 +51,7 @@ CTexture::CTexture(const SP<Aquamarine::IBuffer> buffer, bool keepDataCopy) : m_
auto image = g_pHyprOpenGL->createEGLImage(buffer->dmabuf());
if (!image) {
- Debug::log(ERR, "Cannot create a texture: failed to create an EGLImage");
+ Log::logger->log(Log::ERR, "Cannot create a texture: failed to create an EGLImage");
return;
}
@@ -91,7 +91,7 @@ void CTexture::createFromShm(uint32_t drmFormat, uint8_t* pixels, uint32_t strid
void CTexture::createFromDma(const Aquamarine::SDMABUFAttrs& attrs, void* image) {
if (!g_pHyprOpenGL->m_proc.glEGLImageTargetTexture2DOES) {
- Debug::log(ERR, "Cannot create a dmabuf texture: no glEGLImageTargetTexture2DOES");
+ Log::logger->log(Log::ERR, "Cannot create a dmabuf texture: no glEGLImageTargetTexture2DOES");
return;
}
diff --git a/src/render/decorations/DecorationPositioner.cpp b/src/render/decorations/DecorationPositioner.cpp
index 561d366d..aa849bab 100644
--- a/src/render/decorations/DecorationPositioner.cpp
+++ b/src/render/decorations/DecorationPositioner.cpp
@@ -17,7 +17,7 @@ CDecorationPositioner::CDecorationPositioner() {
Vector2D CDecorationPositioner::getEdgeDefinedPoint(uint32_t edges, PHLWINDOWREF pWindow) {
if (!pWindow) {
- Debug::log(ERR, "getEdgeDefinedPoint: invalid pWindow");
+ Log::logger->log(Log::ERR, "getEdgeDefinedPoint: invalid pWindow");
return {};
}
@@ -29,7 +29,7 @@ Vector2D CDecorationPositioner::getEdgeDefinedPoint(uint32_t edges, PHLWINDOWREF
const int EDGESNO = TOP + BOTTOM + LEFT + RIGHT;
if (EDGESNO == 0 || EDGESNO == 3 || EDGESNO > 4) {
- Debug::log(ERR, "getEdgeDefinedPoint: invalid number of edges");
+ Log::logger->log(Log::ERR, "getEdgeDefinedPoint: invalid number of edges");
return {};
}
@@ -57,7 +57,7 @@ Vector2D CDecorationPositioner::getEdgeDefinedPoint(uint32_t edges, PHLWINDOWREF
if (BOTTOM && LEFT)
return wb.pos() + Vector2D{0.0, wb.size().y};
}
- Debug::log(ERR, "getEdgeDefinedPoint: invalid configuration of edges");
+ Log::logger->log(Log::ERR, "getEdgeDefinedPoint: invalid configuration of edges");
return {};
}
diff --git a/src/render/pass/FramebufferElement.cpp b/src/render/pass/FramebufferElement.cpp
index 7cfa8b4b..77a29fba 100644
--- a/src/render/pass/FramebufferElement.cpp
+++ b/src/render/pass/FramebufferElement.cpp
@@ -16,7 +16,7 @@ void CFramebufferElement::draw(const CRegion& damage) {
}
if (!fb) {
- Debug::log(ERR, "BUG THIS: CFramebufferElement::draw: main but null");
+ Log::logger->log(Log::ERR, "BUG THIS: CFramebufferElement::draw: main but null");
return;
}
@@ -31,7 +31,7 @@ void CFramebufferElement::draw(const CRegion& damage) {
}
if (!fb) {
- Debug::log(ERR, "BUG THIS: CFramebufferElement::draw: not main but null");
+ Log::logger->log(Log::ERR, "BUG THIS: CFramebufferElement::draw: not main but null");
return;
}
}
diff --git a/src/render/pass/SurfacePassElement.cpp b/src/render/pass/SurfacePassElement.cpp
index b5c42310..d3027290 100644
--- a/src/render/pass/SurfacePassElement.cpp
+++ b/src/render/pass/SurfacePassElement.cpp
@@ -315,7 +315,7 @@ CRegion CSurfacePassElement::visibleRegion(bool& cancel) {
void CSurfacePassElement::discard() {
if (!g_pHyprRenderer->m_bBlockSurfaceFeedback) {
- Debug::log(TRACE, "discard for invisible surface");
+ Log::logger->log(Log::TRACE, "discard for invisible surface");
m_data.surface->presentFeedback(m_data.when, m_data.pMonitor->m_self.lock(), true);
}
}
diff --git a/src/xwayland/Dnd.cpp b/src/xwayland/Dnd.cpp
index 924df6b5..963a830e 100644
--- a/src/xwayland/Dnd.cpp
+++ b/src/xwayland/Dnd.cpp
@@ -61,7 +61,7 @@ xcb_window_t CX11DataDevice::getProxyWindow(xcb_window_t window) {
xcb_window_t verifyWindow = *sc<xcb_window_t*>(xcb_get_property_value(proxyVerifyReply));
if (verifyWindow == proxyWindow) {
targetWindow = proxyWindow;
- Debug::log(LOG, "Using XdndProxy window {:x} for window {:x}", proxyWindow, window);
+ Log::logger->log(Log::DEBUG, "Using XdndProxy window {:x} for window {:x}", proxyWindow, window);
}
}
free(proxyVerifyReply); // NOLINT(cppcoreguidelines-no-malloc)
@@ -103,14 +103,14 @@ void CX11DataDevice::sendEnter(uint32_t serial, SP<CWLSurfaceResource> surf, con
auto XSURF = g_pXWayland->m_wm->windowForWayland(surf);
if (!XSURF) {
- Debug::log(ERR, "CX11DataDevice::sendEnter: No xwayland surface for destination");
+ Log::logger->log(Log::ERR, "CX11DataDevice::sendEnter: No xwayland surface for destination");
return;
}
auto SOURCE = offer->getSource();
if (!SOURCE) {
- Debug::log(ERR, "CX11DataDevice::sendEnter: No source");
+ Log::logger->log(Log::ERR, "CX11DataDevice::sendEnter: No source");
return;
}
@@ -141,7 +141,7 @@ void CX11DataDevice::sendEnter(uint32_t serial, SP<CWLSurfaceResource> surf, con
auto hlSurface = XSURF->m_surface.lock();
if (!hlSurface) {
- Debug::log(ERR, "CX11DataDevice::sendEnter: Non desktop x surface?!");
+ Log::logger->log(Log::ERR, "CX11DataDevice::sendEnter: Non desktop x surface?!");
m_lastSurfaceCoords = {};
return;
}
@@ -198,7 +198,7 @@ void CX11DataDevice::sendMotion(uint32_t timeMs, const Vector2D& local) {
void CX11DataDevice::sendDrop() {
#ifndef NO_XWAYLAND
if (!m_lastSurface || !m_lastOffer) {
- Debug::log(ERR, "CX11DataDevice::sendDrop: No surface or offer");
+ Log::logger->log(Log::ERR, "CX11DataDevice::sendDrop: No surface or offer");
return;
}
@@ -256,7 +256,7 @@ bool CX11DataSource::dndDone() {
}
void CX11DataSource::error(uint32_t code, const std::string& msg) {
- Debug::log(ERR, "CX11DataSource error: code {} msg {}", code, msg);
+ Log::logger->log(Log::ERR, "CX11DataSource error: code {} msg {}", code, msg);
m_dndSuccess = false;
m_dropped = false;
}
diff --git a/src/xwayland/Server.cpp b/src/xwayland/Server.cpp
index 6750db10..1ece7454 100644
--- a/src/xwayland/Server.cpp
+++ b/src/xwayland/Server.cpp
@@ -21,7 +21,7 @@
#include "Server.hpp"
#include "XWayland.hpp"
#include "config/ConfigValue.hpp"
-#include "debug/Log.hpp"
+#include "debug/log/Logger.hpp"
#include "../defines.hpp"
#include "../Compositor.hpp"
#include "../managers/CursorManager.hpp"
@@ -41,12 +41,12 @@ static CFileDescriptor createSocket(struct sockaddr_un* addr, size_t pathSize) {
socklen_t size = offsetof(struct sockaddr_un, sun_path) + pathSize + 1;
CFileDescriptor fd{socket(AF_UNIX, SOCK_STREAM, 0)};
if (!fd.isValid()) {
- Debug::log(ERR, "Failed to create socket {}{}", dbgSocketPathPrefix, dbgSocketPathRem);
+ Log::logger->log(Log::ERR, "Failed to create socket {}{}", dbgSocketPathPrefix, dbgSocketPathRem);
return {};
}
if (!fd.setFlags(fd.getFlags() | FD_CLOEXEC)) {
- Debug::log(ERR, "Failed to set flags for socket {}{}", dbgSocketPathPrefix, dbgSocketPathRem);
+ Log::logger->log(Log::ERR, "Failed to set flags for socket {}{}", dbgSocketPathPrefix, dbgSocketPathRem);
return {};
}
@@ -54,7 +54,7 @@ static CFileDescriptor createSocket(struct sockaddr_un* addr, size_t pathSize) {
unlink(addr->sun_path);
if (bind(fd.get(), rc<struct sockaddr*>(addr), size) < 0) {
- Debug::log(ERR, "Failed to bind socket {}{}", dbgSocketPathPrefix, dbgSocketPathRem);
+ Log::logger->log(Log::ERR, "Failed to bind socket {}{}", dbgSocketPathPrefix, dbgSocketPathRem);
if (isRegularSocket)
unlink(addr->sun_path);
return {};
@@ -66,11 +66,11 @@ static CFileDescriptor createSocket(struct sockaddr_un* addr, size_t pathSize) {
if (isRegularSocket && chmod(addr->sun_path, 0666) < 0) {
// We are only extending the default permissions,
// and I don't see the reason to make a full stop in case of a failed operation.
- Debug::log(ERR, "Failed to set permission mode for socket {}{}", dbgSocketPathPrefix, dbgSocketPathRem);
+ Log::logger->log(Log::ERR, "Failed to set permission mode for socket {}{}", dbgSocketPathPrefix, dbgSocketPathRem);
}
if (listen(fd.get(), SOCKET_BACKLOG) < 0) {
- Debug::log(ERR, "Failed to listen to socket {}{}", dbgSocketPathPrefix, dbgSocketPathRem);
+ Log::logger->log(Log::ERR, "Failed to listen to socket {}{}", dbgSocketPathPrefix, dbgSocketPathRem);
if (isRegularSocket)
unlink(addr->sun_path);
return {};
@@ -83,23 +83,23 @@ static bool checkPermissionsForSocketDir() {
struct stat buf;
if (lstat("/tmp/.X11-unix", &buf)) {
- Debug::log(ERR, "Failed to stat X11 socket dir");
+ Log::logger->log(Log::ERR, "Failed to stat X11 socket dir");
return false;
}
if (!(buf.st_mode & S_IFDIR)) {
- Debug::log(ERR, "X11 socket dir is not a directory");
+ Log::logger->log(Log::ERR, "X11 socket dir is not a directory");
return false;
}
if ((buf.st_uid != 0) && (buf.st_uid != getuid())) {
- Debug::log(ERR, "X11 socket dir is not owned by root or current user");
+ Log::logger->log(Log::ERR, "X11 socket dir is not owned by root or current user");
return false;
}
if (!(buf.st_mode & S_ISVTX)) {
if ((buf.st_mode & (S_IWGRP | S_IWOTH))) {
- Debug::log(ERR, "X11 socket dir is writable by others");
+ Log::logger->log(Log::ERR, "X11 socket dir is writable by others");
return false;
}
}
@@ -112,7 +112,7 @@ static bool ensureSocketDirExists() {
if (errno == EEXIST)
return checkPermissionsForSocketDir();
else {
- Debug::log(ERR, "XWayland: Couldn't create socket dir");
+ Log::logger->log(Log::ERR, "XWayland: Couldn't create socket dir");
return false;
}
}
@@ -149,7 +149,7 @@ static bool openSockets(std::array<CFileDescriptor, 2>& sockets, int display) {
}
#else
if (*CREATEABSTRACTSOCKET) {
- Debug::log(WARN, "The abstract XWayland Unix domain socket might be used only on Linux systems. A regular one'll be created instead.");
+ Log::logger->log(Log::WARN, "The abstract XWayland Unix domain socket might be used only on Linux systems. A regular one'll be created instead.");
}
path = getSocketPath(display, false);
strncpy(addr.sun_path, path.c_str(), path.length() + 1);
@@ -173,7 +173,7 @@ static bool openSockets(std::array<CFileDescriptor, 2>& sockets, int display) {
static void startServer(void* data) {
if (!g_pXWayland->m_server->start())
- Debug::log(ERR, "The XWayland server could not start! XWayland will not work...");
+ Log::logger->log(Log::ERR, "The XWayland server could not start! XWayland will not work...");
}
static int xwaylandReady(int fd, uint32_t mask, void* data) {
@@ -183,7 +183,7 @@ static int xwaylandReady(int fd, uint32_t mask, void* data) {
static bool safeRemove(const std::string& path) {
try {
return std::filesystem::remove(path);
- } catch (const std::exception& e) { Debug::log(ERR, "[XWayland] Failed to remove {}", path); }
+ } catch (const std::exception& e) { Log::logger->log(Log::ERR, "[XWayland] Failed to remove {}", path); }
return false;
}
@@ -232,11 +232,11 @@ bool CXWaylandServer::tryOpenSockets() {
}
if (m_display < 0) {
- Debug::log(ERR, "Failed to find a suitable socket for XWayland");
+ Log::logger->log(Log::ERR, "Failed to find a suitable socket for XWayland");
return false;
}
- Debug::log(LOG, "XWayland found a suitable display socket at DISPLAY: {}", m_displayName);
+ Log::logger->log(Log::DEBUG, "XWayland found a suitable display socket at DISPLAY: {}", m_displayName);
return true;
}
@@ -295,7 +295,7 @@ bool CXWaylandServer::create() {
void CXWaylandServer::runXWayland(CFileDescriptor& notifyFD) {
if (!m_xFDs[0].setFlags(m_xFDs[0].getFlags() & ~FD_CLOEXEC) || !m_xFDs[1].setFlags(m_xFDs[1].getFlags() & ~FD_CLOEXEC) ||
!m_waylandFDs[1].setFlags(m_waylandFDs[1].getFlags() & ~FD_CLOEXEC) || !m_xwmFDs[1].setFlags(m_xwmFDs[1].getFlags() & ~FD_CLOEXEC)) {
- Debug::log(ERR, "Failed to unset cloexec on fds");
+ Log::logger->log(Log::ERR, "Failed to unset cloexec on fds");
_exit(EXIT_FAILURE);
}
@@ -305,11 +305,11 @@ void CXWaylandServer::runXWayland(CFileDescriptor& notifyFD) {
auto waylandSocket = std::format("{}", m_waylandFDs[1].get());
setenv("WAYLAND_SOCKET", waylandSocket.c_str(), true);
- Debug::log(LOG, "Starting XWayland with \"{}\", bon voyage!", cmd);
+ Log::logger->log(Log::DEBUG, "Starting XWayland with \"{}\", bon voyage!", cmd);
execl("/bin/sh", "/bin/sh", "-c", cmd.c_str(), nullptr);
- Debug::log(ERR, "XWayland failed to open");
+ Log::logger->log(Log::ERR, "XWayland failed to open");
_exit(1);
}
@@ -317,7 +317,7 @@ bool CXWaylandServer::start() {
m_idleSource = nullptr;
int wlPair[2] = {-1, -1};
if (socketpair(AF_UNIX, SOCK_STREAM, 0, wlPair) != 0) {
- Debug::log(ERR, "socketpair failed (1)");
+ Log::logger->log(Log::ERR, "socketpair failed (1)");
die();
return false;
}
@@ -325,14 +325,14 @@ bool CXWaylandServer::start() {
m_waylandFDs[1] = CFileDescriptor{wlPair[1]};
if (!m_waylandFDs[0].setFlags(m_waylandFDs[0].getFlags() | FD_CLOEXEC) || !m_waylandFDs[1].setFlags(m_waylandFDs[1].getFlags() | FD_CLOEXEC)) {
- Debug::log(ERR, "set_cloexec failed (1)");
+ Log::logger->log(Log::ERR, "set_cloexec failed (1)");
die();
return false;
}
int xwmPair[2] = {-1, -1};
if (socketpair(AF_UNIX, SOCK_STREAM, 0, xwmPair) != 0) {
- Debug::log(ERR, "socketpair failed (2)");
+ Log::logger->log(Log::ERR, "socketpair failed (2)");
die();
return false;
}
@@ -341,14 +341,14 @@ bool CXWaylandServer::start() {
m_xwmFDs[1] = CFileDescriptor{xwmPair[1]};
if (!m_xwmFDs[0].setFlags(m_xwmFDs[0].getFlags() | FD_CLOEXEC) || !m_xwmFDs[1].setFlags(m_xwmFDs[1].getFlags() | FD_CLOEXEC)) {
- Debug::log(ERR, "set_cloexec failed (2)");
+ Log::logger->log(Log::ERR, "set_cloexec failed (2)");
die();
return false;
}
m_xwaylandClient = wl_client_create(g_pCompositor->m_wlDisplay, m_waylandFDs[0].get());
if (!m_xwaylandClient) {
- Debug::log(ERR, "wl_client_create failed");
+ Log::logger->log(Log::ERR, "wl_client_create failed");
die();
return false;
}
@@ -357,7 +357,7 @@ bool CXWaylandServer::start() {
int notify[2] = {-1, -1};
if (pipe(notify) < 0) {
- Debug::log(ERR, "pipe failed");
+ Log::logger->log(Log::ERR, "pipe failed");
die();
return false;
}
@@ -365,7 +365,7 @@ bool CXWaylandServer::start() {
CFileDescriptor notifyFds[2] = {CFileDescriptor{notify[0]}, CFileDescriptor{notify[1]}};
if (!notifyFds[0].setFlags(notifyFds[0].getFlags() | FD_CLOEXEC)) {
- Debug::log(ERR, "set_cloexec failed (3)");
+ Log::logger->log(Log::ERR, "set_cloexec failed (3)");
die();
return false;
}
@@ -375,7 +375,7 @@ bool CXWaylandServer::start() {
auto serverPID = fork();
if (serverPID < 0) {
- Debug::log(ERR, "fork failed");
+ Log::logger->log(Log::ERR, "fork failed");
die();
return false;
} else if (serverPID == 0) {
@@ -392,7 +392,7 @@ int CXWaylandServer::ready(int fd, uint32_t mask) {
char buf[64];
ssize_t n = read(fd, buf, sizeof(buf));
if (n < 0 && errno != EINTR) {
- Debug::log(ERR, "Xwayland: read from displayFd failed");
+ Log::logger->log(Log::ERR, "Xwayland: read from displayFd failed");
mask = 0;
} else if (n <= 0 || buf[n - 1] != '\n')
return 1;
@@ -400,12 +400,12 @@ int CXWaylandServer::ready(int fd, uint32_t mask) {
// if we don't have readable here, it failed
if (!(mask & WL_EVENT_READABLE)) {
- Debug::log(ERR, "Xwayland: startup failed, not setting up xwm");
+ Log::logger->log(Log::ERR, "Xwayland: startup failed, not setting up xwm");
g_pXWayland->m_server.reset();
return 1;
}
- Debug::log(LOG, "XWayland is ready");
+ Log::logger->log(Log::DEBUG, "XWayland is ready");
wl_event_source_remove(m_pipeSource);
m_pipeFd.reset();
diff --git a/src/xwayland/XDataSource.cpp b/src/xwayland/XDataSource.cpp
index 8e7b2505..5d34a9d8 100644
--- a/src/xwayland/XDataSource.cpp
+++ b/src/xwayland/XDataSource.cpp
@@ -65,11 +65,11 @@ void CXDataSource::send(const std::string& mime, CFileDescriptor fd) {
}
if (!mimeAtom) {
- Debug::log(ERR, "[XDataSource] mime atom not found");
+ Log::logger->log(Log::ERR, "[XDataSource] mime atom not found");
return;
}
- Debug::log(LOG, "[XDataSource] send with mime {} to fd {}", mime, fd.get());
+ Log::logger->log(Log::DEBUG, "[XDataSource] send with mime {} to fd {}", mime, fd.get());
auto transfer = makeUnique<SXTransfer>(m_selection);
transfer->incomingWindow = xcb_generate_id(g_pXWayland->m_wm->getConnection());
@@ -94,15 +94,15 @@ void CXDataSource::send(const std::string& mime, CFileDescriptor fd) {
}
void CXDataSource::accepted(const std::string& mime) {
- Debug::log(LOG, "[XDataSource] accepted is a stub");
+ Log::logger->log(Log::DEBUG, "[XDataSource] accepted is a stub");
}
void CXDataSource::cancelled() {
- Debug::log(LOG, "[XDataSource] cancelled is a stub");
+ Log::logger->log(Log::DEBUG, "[XDataSource] cancelled is a stub");
}
void CXDataSource::error(uint32_t code, const std::string& msg) {
- Debug::log(LOG, "[XDataSource] error is a stub: err {}: {}", code, msg);
+ Log::logger->log(Log::DEBUG, "[XDataSource] error is a stub: err {}: {}", code, msg);
}
eDataSourceType CXDataSource::type() {
diff --git a/src/xwayland/XSurface.cpp b/src/xwayland/XSurface.cpp
index 73c512f2..bc74f54d 100644
--- a/src/xwayland/XSurface.cpp
+++ b/src/xwayland/XSurface.cpp
@@ -98,7 +98,7 @@ void CXWaylandSurface::map() {
m_mapped = true;
m_surface->map();
- Debug::log(LOG, "XWayland surface {:x} mapping", rc<uintptr_t>(this));
+ Log::logger->log(Log::DEBUG, "XWayland surface {:x} mapping", rc<uintptr_t>(this));
m_events.map.emit();
@@ -118,7 +118,7 @@ void CXWaylandSurface::unmap() {
m_events.unmap.emit();
m_surface->unmap();
- Debug::log(LOG, "XWayland surface {:x} unmapping", rc<uintptr_t>(this));
+ Log::logger->log(Log::DEBUG, "XWayland surface {:x} unmapping", rc<uintptr_t>(this));
g_pXWayland->m_wm->updateClientList();
}
@@ -128,17 +128,17 @@ void CXWaylandSurface::considerMap() {
return;
if (!m_surface) {
- Debug::log(LOG, "XWayland surface: considerMap, nope, no surface");
+ Log::logger->log(Log::DEBUG, "XWayland surface: considerMap, nope, no surface");
return;
}
if (m_surface->m_current.texture) {
- Debug::log(LOG, "XWayland surface: considerMap, sure, we have a buffer");
+ Log::logger->log(Log::DEBUG, "XWayland surface: considerMap, sure, we have a buffer");
map();
return;
}
- Debug::log(LOG, "XWayland surface: considerMap, nope, we don't have a buffer");
+ Log::logger->log(Log::DEBUG, "XWayland surface: considerMap, nope, we don't have a buffer");
}
bool CXWaylandSurface::wantsFocus() {
@@ -250,7 +250,7 @@ void CXWaylandSurface::ping() {
bool supportsPing = std::ranges::find(m_protocols, HYPRATOMS["_NET_WM_PING"]) != m_protocols.end();
if (!supportsPing) {
- Debug::log(TRACE, "CXWaylandSurface: XID {} does not support ping, just sending an instant reply", m_xID);
+ Log::logger->log(Log::TRACE, "CXWaylandSurface: XID {} does not support ping, just sending an instant reply", m_xID);
g_pANRManager->onResponse(m_self.lock());
return;
}
diff --git a/src/xwayland/XWM.cpp b/src/xwayland/XWM.cpp
index 48afe3ab..4e7fc5be 100644
--- a/src/xwayland/XWM.cpp
+++ b/src/xwayland/XWM.cpp
@@ -18,6 +18,7 @@
#include "../managers/eventLoop/EventLoopManager.hpp"
#include "../managers/SeatManager.hpp"
#include "../managers/ANRManager.hpp"
+#include "../helpers/env/Env.hpp"
#include "../protocols/XWaylandShell.hpp"
#include "../protocols/core/Compositor.hpp"
#include "../desktop/state/FocusState.hpp"
@@ -56,12 +57,12 @@ void CXWM::handleCreate(xcb_create_notify_event_t* e) {
const auto XSURF = m_surfaces.emplace_back(SP<CXWaylandSurface>(new CXWaylandSurface(e->window, CBox{e->x, e->y, e->width, e->height}, e->override_redirect)));
XSURF->m_self = XSURF;
- Debug::log(LOG, "[xwm] New XSurface at {:x} with xid of {}", rc<uintptr_t>(XSURF.get()), e->window);
+ Log::logger->log(Log::DEBUG, "[xwm] New XSurface at {:x} with xid of {}", rc<uintptr_t>(XSURF.get()), e->window);
const auto WINDOW = Desktop::View::CWindow::create(XSURF);
g_pCompositor->m_windows.emplace_back(WINDOW);
WINDOW->m_self = WINDOW;
- Debug::log(LOG, "[xwm] New XWayland window at {:x} for surf {:x}", rc<uintptr_t>(WINDOW.get()), rc<uintptr_t>(XSURF.get()));
+ Log::logger->log(Log::DEBUG, "[xwm] New XWayland window at {:x} for surf {:x}", rc<uintptr_t>(WINDOW.get()), rc<uintptr_t>(XSURF.get()));
}
void CXWM::handleDestroy(xcb_destroy_notify_event_t* e) {
@@ -123,8 +124,8 @@ void CXWM::handleMapRequest(xcb_map_request_event_t* e) {
if (SMALL && !XSURF->m_overrideRedirect) // default to 800 x 800
XSURF->configure({XSURF->m_geometry.pos(), DESIREDSIZE});
- Debug::log(LOG, "[xwm] Mapping window {} in X (geometry {}x{} at {}x{}))", e->window, XSURF->m_geometry.width, XSURF->m_geometry.height, XSURF->m_geometry.x,
- XSURF->m_geometry.y);
+ Log::logger->log(Log::DEBUG, "[xwm] Mapping window {} in X (geometry {}x{} at {}x{}))", e->window, XSURF->m_geometry.width, XSURF->m_geometry.height, XSURF->m_geometry.x,
+ XSURF->m_geometry.y);
// read data again. Some apps for some reason fail to send WINDOW_TYPE
// this shouldn't happen but does, I prolly fucked up somewhere, this is a band-aid
@@ -208,7 +209,7 @@ std::string CXWM::getAtomName(uint32_t atom) {
void CXWM::readProp(SP<CXWaylandSurface> XSURF, uint32_t atom, xcb_get_property_reply_t* reply) {
std::string propName;
- if (Debug::m_trace)
+ if (Env::isTrace())
propName = getAtomName(atom);
const auto valueLen = xcb_get_property_value_length(reply);
@@ -274,7 +275,7 @@ void CXWM::readProp(SP<CXWaylandSurface> XSURF, uint32_t atom, xcb_get_property_
XSURF->m_parent = NEWXSURF;
NEWXSURF->m_children.emplace_back(XSURF);
} else
- Debug::log(LOG, "[xwm] Denying transient because it would create a loop");
+ Log::logger->log(Log::DEBUG, "[xwm] Denying transient because it would create a loop");
};
auto handleSizeHints = [&]() {
@@ -330,11 +331,11 @@ void CXWM::readProp(SP<CXWaylandSurface> XSURF, uint32_t atom, xcb_get_property_
else if (atom == HYPRATOMS["WM_PROTOCOLS"])
handleWMProtocols();
else {
- Debug::log(TRACE, "[xwm] Unhandled prop {} -> {}", atom, propName);
+ Log::logger->log(Log::TRACE, "[xwm] Unhandled prop {} -> {}", atom, propName);
return;
}
- Debug::log(TRACE, "[xwm] Handled prop {} -> {}", atom, propName);
+ Log::logger->log(Log::TRACE, "[xwm] Handled prop {} -> {}", atom, propName);
}
void CXWM::handlePropertyNotify(xcb_property_notify_event_t* e) {
@@ -347,7 +348,7 @@ void CXWM::handlePropertyNotify(xcb_property_notify_event_t* e) {
XCBReplyPtr<xcb_get_property_reply_t> reply(xcb_get_property_reply(getConnection(), cookie, nullptr));
if (!reply) {
- Debug::log(ERR, "[xwm] Failed to read property notify cookie");
+ Log::logger->log(Log::ERR, "[xwm] Failed to read property notify cookie");
return;
}
@@ -369,7 +370,7 @@ void CXWM::handleClientMessage(xcb_client_message_event_t* e) {
}
} else if (e->type == HYPRATOMS["WL_SURFACE_ID"]) {
if (XSURF->m_surface) {
- Debug::log(WARN, "[xwm] Re-assignment of WL_SURFACE_ID");
+ Log::logger->log(Log::WARN, "[xwm] Re-assignment of WL_SURFACE_ID");
dissociate(XSURF);
}
@@ -381,7 +382,7 @@ void CXWM::handleClientMessage(xcb_client_message_event_t* e) {
}
} else if (e->type == HYPRATOMS["WL_SURFACE_SERIAL"]) {
if (XSURF->m_wlSerial) {
- Debug::log(WARN, "[xwm] Re-assignment of WL_SURFACE_SERIAL");
+ Log::logger->log(Log::WARN, "[xwm] Re-assignment of WL_SURFACE_SERIAL");
dissociate(XSURF);
}
@@ -389,7 +390,7 @@ void CXWM::handleClientMessage(xcb_client_message_event_t* e) {
uint32_t serialHigh = e->data.data32[1];
XSURF->m_wlSerial = (sc<uint64_t>(serialHigh) << 32) | serialLow;
- Debug::log(LOG, "[xwm] surface {:x} requests serial {:x}", rc<uintptr_t>(XSURF.get()), XSURF->m_wlSerial);
+ Log::logger->log(Log::DEBUG, "[xwm] surface {:x} requests serial {:x}", rc<uintptr_t>(XSURF.get()), XSURF->m_wlSerial);
for (auto const& res : m_shellResources) {
if (!res)
@@ -445,7 +446,7 @@ void CXWM::handleClientMessage(xcb_client_message_event_t* e) {
XSURF->m_events.activate.emit();
} else if (e->type == HYPRATOMS["XdndStatus"]) {
if (m_dndDataOffers.empty() || !m_dndDataOffers.at(0)->getSource()) {
- Debug::log(TRACE, "[xwm] Rejecting XdndStatus message: nothing to get");
+ Log::logger->log(Log::TRACE, "[xwm] Rejecting XdndStatus message: nothing to get");
return;
}
@@ -455,22 +456,22 @@ void CXWM::handleClientMessage(xcb_client_message_event_t* e) {
if (ACCEPTED)
m_dndDataOffers.at(0)->getSource()->accepted("");
- Debug::log(LOG, "[xwm] XdndStatus: accepted: {}");
+ Log::logger->log(Log::DEBUG, "[xwm] XdndStatus: accepted: {}");
} else if (e->type == HYPRATOMS["XdndFinished"]) {
if (m_dndDataOffers.empty() || !m_dndDataOffers.at(0)->getSource()) {
- Debug::log(TRACE, "[xwm] Rejecting XdndFinished message: nothing to get");
+ Log::logger->log(Log::TRACE, "[xwm] Rejecting XdndFinished message: nothing to get");
return;
}
m_dndDataOffers.at(0)->getSource()->sendDndFinished();
- Debug::log(LOG, "[xwm] XdndFinished");
+ Log::logger->log(Log::DEBUG, "[xwm] XdndFinished");
} else {
- Debug::log(TRACE, "[xwm] Unhandled message prop {} -> {}", e->type, propName);
+ Log::logger->log(Log::TRACE, "[xwm] Unhandled message prop {} -> {}", e->type, propName);
return;
}
- Debug::log(TRACE, "[xwm] Handled message prop {} -> {}", e->type, propName);
+ Log::logger->log(Log::TRACE, "[xwm] Handled message prop {} -> {}", e->type, propName);
}
void CXWM::handleFocusIn(xcb_focus_in_event_t* e) {
@@ -489,15 +490,15 @@ void CXWM::handleFocusIn(xcb_focus_in_event_t* e) {
}
void CXWM::handleFocusOut(xcb_focus_out_event_t* e) {
- Debug::log(TRACE, "[xwm] focusOut mode={}, detail={}, event={}", e->mode, e->detail, e->event);
+ Log::logger->log(Log::TRACE, "[xwm] focusOut mode={}, detail={}, event={}", e->mode, e->detail, e->event);
const auto XSURF = windowForXID(e->event);
if (!XSURF)
return;
- Debug::log(TRACE, "[xwm] focusOut for {} {} {} surface {}", XSURF->m_mapped ? "mapped" : "unmapped", XSURF->m_fullscreen ? "fullscreen" : "windowed",
- XSURF == m_focusedSurface ? "focused" : "unfocused", XSURF->m_state.title);
+ Log::logger->log(Log::TRACE, "[xwm] focusOut for {} {} {} surface {}", XSURF->m_mapped ? "mapped" : "unmapped", XSURF->m_fullscreen ? "fullscreen" : "windowed",
+ XSURF == m_focusedSurface ? "focused" : "unfocused", XSURF->m_state.title);
// do something?
}
@@ -556,7 +557,7 @@ void CXWM::focusWindow(SP<CXWaylandSurface> surf) {
void CXWM::handleError(xcb_value_error_t* e) {
const char* major_name = xcb_errors_get_name_for_major_code(m_errors, e->major_opcode);
if (!major_name) {
- Debug::log(ERR, "xcb error happened, but could not get major name");
+ Log::logger->log(Log::ERR, "xcb error happened, but could not get major name");
return;
}
@@ -565,12 +566,12 @@ void CXWM::handleError(xcb_value_error_t* e) {
const char* extension;
const char* error_name = xcb_errors_get_name_for_error(m_errors, e->error_code, &extension);
if (!error_name) {
- Debug::log(ERR, "xcb error happened, but could not get error name");
+ Log::logger->log(Log::ERR, "xcb error happened, but could not get error name");
return;
}
- Debug::log(ERR, "[xwm] xcb error: {} ({}), code {} ({}), seq {}, val {}", major_name, minor_name ? minor_name : "no minor", error_name, extension ? extension : "no extension",
- e->sequence, e->bad_value);
+ Log::logger->log(Log::ERR, "[xwm] xcb error: {} ({}), code {} ({}), seq {}, val {}", major_name, minor_name ? minor_name : "no minor", error_name,
+ extension ? extension : "no extension", e->sequence, e->bad_value);
}
void CXWM::selectionSendNotify(xcb_selection_request_event_t* e, bool success) {
@@ -620,19 +621,19 @@ std::string CXWM::mimeFromAtom(xcb_atom_t atom) {
}
void CXWM::handleSelectionNotify(xcb_selection_notify_event_t* e) {
- Debug::log(TRACE, "[xwm] Selection notify for {} prop {} target {}", e->selection, e->property, e->target);
+ Log::logger->log(Log::TRACE, "[xwm] Selection notify for {} prop {} target {}", e->selection, e->property, e->target);
SXSelection* sel = getSelection(e->selection);
if (e->property == XCB_ATOM_NONE) {
auto it = std::ranges::find_if(sel->transfers, [](const auto& t) { return !t->propertyReply; });
if (it != sel->transfers.end()) {
- Debug::log(TRACE, "[xwm] converting selection failed");
+ Log::logger->log(Log::TRACE, "[xwm] converting selection failed");
sel->transfers.erase(it);
}
} else if (e->target == HYPRATOMS["TARGETS"]) {
if (!m_focusedSurface) {
- Debug::log(TRACE, "[xwm] denying access to write to clipboard because no X client is in focus");
+ Log::logger->log(Log::TRACE, "[xwm] denying access to write to clipboard because no X client is in focus");
return;
}
@@ -672,13 +673,13 @@ SXSelection* CXWM::getSelection(xcb_atom_t atom) {
}
void CXWM::handleSelectionRequest(xcb_selection_request_event_t* e) {
- Debug::log(TRACE, "[xwm] Selection request for {} prop {} target {} time {} requestor {} selection {}", e->selection, e->property, e->target, e->time, e->requestor,
- e->selection);
+ Log::logger->log(Log::TRACE, "[xwm] Selection request for {} prop {} target {} time {} requestor {} selection {}", e->selection, e->property, e->target, e->time, e->requestor,
+ e->selection);
SXSelection* sel = getSelection(e->selection);
if (!sel) {
- Debug::log(ERR, "[xwm] No selection");
+ Log::logger->log(Log::ERR, "[xwm] No selection");
selectionSendNotify(e, false);
return;
}
@@ -689,13 +690,13 @@ void CXWM::handleSelectionRequest(xcb_selection_request_event_t* e) {
}
if (sel->window != e->owner && e->time != XCB_CURRENT_TIME && e->time < sel->timestamp) {
- Debug::log(ERR, "[xwm] outdated selection request. Time {} < {}", e->time, sel->timestamp);
+ Log::logger->log(Log::ERR, "[xwm] outdated selection request. Time {} < {}", e->time, sel->timestamp);
selectionSendNotify(e, false);
return;
}
if (!g_pSeatManager->m_state.keyboardFocusResource || g_pSeatManager->m_state.keyboardFocusResource->client() != g_pXWayland->m_server->m_xwaylandClient) {
- Debug::log(TRACE, "[xwm] Ignoring clipboard access: xwayland not in focus");
+ Log::logger->log(Log::TRACE, "[xwm] Ignoring clipboard access: xwayland not in focus");
selectionSendNotify(e, false);
return;
}
@@ -709,7 +710,7 @@ void CXWM::handleSelectionRequest(xcb_selection_request_event_t* e) {
mimes = m_dndDataOffers.at(0)->m_source->mimes();
if (mimes.empty())
- Debug::log(WARN, "[xwm] WARNING: No mimes in TARGETS?");
+ Log::logger->log(Log::WARN, "[xwm] WARNING: No mimes in TARGETS?");
std::vector<xcb_atom_t> atoms;
// reserve to avoid reallocations
@@ -732,13 +733,13 @@ void CXWM::handleSelectionRequest(xcb_selection_request_event_t* e) {
std::string mime = mimeFromAtom(e->target);
if (mime == "INVALID") {
- Debug::log(LOG, "[xwm] Ignoring clipboard access: invalid mime atom {}", e->target);
+ Log::logger->log(Log::DEBUG, "[xwm] Ignoring clipboard access: invalid mime atom {}", e->target);
selectionSendNotify(e, false);
return;
}
if (!sel->sendData(e, mime)) {
- Debug::log(LOG, "[xwm] Failed to send selection :(");
+ Log::logger->log(Log::DEBUG, "[xwm] Failed to send selection :(");
selectionSendNotify(e, false);
return;
}
@@ -746,7 +747,7 @@ void CXWM::handleSelectionRequest(xcb_selection_request_event_t* e) {
}
bool CXWM::handleSelectionXFixesNotify(xcb_xfixes_selection_notify_event_t* e) {
- Debug::log(TRACE, "[xwm] Selection xfixes notify for {}", e->selection);
+ Log::logger->log(Log::TRACE, "[xwm] Selection xfixes notify for {}", e->selection);
// IMPORTANT: mind the g_pSeatManager below
SXSelection* sel = getSelection(e->selection);
@@ -806,8 +807,8 @@ bool CXWM::handleSelectionEvent(xcb_generic_event_t* e) {
int CXWM::onEvent(int fd, uint32_t mask) {
if ((mask & WL_EVENT_HANGUP) || (mask & WL_EVENT_ERROR)) {
- Debug::log(ERR, "XWayland has yeeten the xwm off?!");
- Debug::log(CRIT, "XWayland has yeeten the xwm off?!");
+ Log::logger->log(Log::ERR, "XWayland has yeeten the xwm off?!");
+ Log::logger->log(Log::CRIT, "XWayland has yeeten the xwm off?!");
// Attempt to create fresh instance
g_pEventLoopManager->doLater([]() {
g_pXWayland->m_wm.reset();
@@ -843,7 +844,7 @@ int CXWM::onEvent(int fd, uint32_t mask) {
case XCB_FOCUS_OUT: handleFocusOut(rc<xcb_focus_out_event_t*>(event.get())); break;
case 0: handleError(rc<xcb_value_error_t*>(event.get())); break;
default: {
- Debug::log(TRACE, "[xwm] unhandled event {}", event->response_type & XCB_EVENT_RESPONSE_TYPE_MASK);
+ Log::logger->log(Log::TRACE, "[xwm] unhandled event {}", event->response_type & XCB_EVENT_RESPONSE_TYPE_MASK);
}
}
}
@@ -864,7 +865,7 @@ void CXWM::gatherResources() {
XCBReplyPtr<xcb_intern_atom_reply_t> reply(xcb_intern_atom_reply(getConnection(), cookie, nullptr));
if (!reply) {
- Debug::log(ERR, "[xwm] Atom failed: {}", ATOM.first);
+ Log::logger->log(Log::ERR, "[xwm] Atom failed: {}", ATOM.first);
continue;
}
@@ -874,13 +875,13 @@ void CXWM::gatherResources() {
m_xfixes = xcb_get_extension_data(getConnection(), &xcb_xfixes_id);
if (!m_xfixes || !m_xfixes->present)
- Debug::log(WARN, "XFixes not available");
+ Log::logger->log(Log::WARN, "XFixes not available");
auto xfixes_cookie = xcb_xfixes_query_version(getConnection(), XCB_XFIXES_MAJOR_VERSION, XCB_XFIXES_MINOR_VERSION);
XCBReplyPtr<xcb_xfixes_query_version_reply_t> xfixes_reply(xcb_xfixes_query_version_reply(getConnection(), xfixes_cookie, nullptr));
if (xfixes_reply) {
- Debug::log(LOG, "xfixes version: {}.{}", xfixes_reply->major_version, xfixes_reply->minor_version);
+ Log::logger->log(Log::DEBUG, "xfixes version: {}.{}", xfixes_reply->major_version, xfixes_reply->minor_version);
m_xfixesMajor = xfixes_reply->major_version;
}
@@ -893,7 +894,7 @@ void CXWM::gatherResources() {
if (!xres_reply)
return;
- Debug::log(LOG, "xres version: {}.{}", xres_reply->server_major, xres_reply->server_minor);
+ Log::logger->log(Log::DEBUG, "xres version: {}.{}", xres_reply->server_major, xres_reply->server_minor);
if (xres_reply->server_major > 1 || (xres_reply->server_major == 1 && xres_reply->server_minor >= 2)) {
m_xres = xresReply1;
}
@@ -917,7 +918,7 @@ void CXWM::getVisual() {
}
if (visualtype == nullptr) {
- Debug::log(LOG, "xwm: No 32-bit visualtype");
+ Log::logger->log(Log::DEBUG, "xwm: No 32-bit visualtype");
return;
}
@@ -931,7 +932,7 @@ void CXWM::getRenderFormat() {
XCBReplyPtr<xcb_render_query_pict_formats_reply_t> reply(xcb_render_query_pict_formats_reply(getConnection(), cookie, nullptr));
if (!reply) {
- Debug::log(LOG, "xwm: No xcb_render_query_pict_formats_reply_t reply");
+ Log::logger->log(Log::DEBUG, "xwm: No xcb_render_query_pict_formats_reply_t reply");
return;
}
@@ -947,7 +948,7 @@ void CXWM::getRenderFormat() {
}
if (format == nullptr) {
- Debug::log(LOG, "xwm: No 32-bit render format");
+ Log::logger->log(Log::DEBUG, "xwm: No 32-bit render format");
return;
}
@@ -957,13 +958,13 @@ void CXWM::getRenderFormat() {
CXWM::CXWM() : m_connection(makeUnique<CXCBConnection>(g_pXWayland->m_server->m_xwmFDs[0].get())) {
if (m_connection->hasError()) {
- Debug::log(ERR, "[xwm] Couldn't start, error {}", m_connection->hasError());
+ Log::logger->log(Log::ERR, "[xwm] Couldn't start, error {}", m_connection->hasError());
return;
}
CXCBErrorContext xcbErrCtx(getConnection());
if (!xcbErrCtx.isValid()) {
- Debug::log(ERR, "[xwm] Couldn't allocate errors context");
+ Log::logger->log(Log::ERR, "[xwm] Couldn't allocate errors context");
return;
}
@@ -1050,8 +1051,8 @@ void CXWM::activateSurface(SP<CXWaylandSurface> surf, bool activate) {
}
void CXWM::sendState(SP<CXWaylandSurface> surf) {
- Debug::log(TRACE, "[xwm] sendState for {} {} {} surface {}", surf->m_mapped ? "mapped" : "unmapped", surf->m_fullscreen ? "fullscreen" : "windowed",
- surf == m_focusedSurface ? "focused" : "unfocused", surf->m_state.title);
+ Log::logger->log(Log::TRACE, "[xwm] sendState for {} {} {} surface {}", surf->m_mapped ? "mapped" : "unmapped", surf->m_fullscreen ? "fullscreen" : "windowed",
+ surf == m_focusedSurface ? "focused" : "unfocused", surf->m_state.title);
if (surf->m_fullscreen && surf->m_mapped && surf == m_focusedSurface)
surf->setWithdrawn(false); // resend normal state
@@ -1083,7 +1084,7 @@ void CXWM::onNewSurface(SP<CWLSurfaceResource> surf) {
if (surf->client() != g_pXWayland->m_server->m_xwaylandClient)
return;
- Debug::log(LOG, "[xwm] New XWayland surface at {:x}", rc<uintptr_t>(surf.get()));
+ Log::logger->log(Log::DEBUG, "[xwm] New XWayland surface at {:x}", rc<uintptr_t>(surf.get()));
const auto WLID = surf->id();
@@ -1095,11 +1096,11 @@ void CXWM::onNewSurface(SP<CWLSurfaceResource> surf) {
return;
}
- Debug::log(WARN, "[xwm] CXWM::onNewSurface: no matching xwaylandSurface");
+ Log::logger->log(Log::WARN, "[xwm] CXWM::onNewSurface: no matching xwaylandSurface");
}
void CXWM::onNewResource(SP<CXWaylandSurfaceResource> resource) {
- Debug::log(LOG, "[xwm] New XWayland resource at {:x}", rc<uintptr_t>(resource.get()));
+ Log::logger->log(Log::DEBUG, "[xwm] New XWayland resource at {:x}", rc<uintptr_t>(resource.get()));
std::erase_if(m_shellResources, [](const auto& e) { return e.expired(); });
m_shellResources.emplace_back(resource);
@@ -1124,7 +1125,7 @@ void CXWM::readWindowData(SP<CXWaylandSurface> surf) {
xcb_get_property_cookie_t cookie = xcb_get_property(getConnection(), 0, surf->m_xID, interestingProps[i], XCB_ATOM_ANY, 0, 2048);
XCBReplyPtr<xcb_get_property_reply_t> reply(xcb_get_property_reply(getConnection(), cookie, nullptr));
if (!reply) {
- Debug::log(ERR, "[xwm] Failed to get window property");
+ Log::logger->log(Log::ERR, "[xwm] Failed to get window property");
continue;
}
readProp(surf, interestingProps[i], reply.get());
@@ -1147,7 +1148,7 @@ void CXWM::associate(SP<CXWaylandSurface> surf, SP<CWLSurfaceResource> wlSurf) {
auto existing = std::ranges::find_if(m_surfaces, [wlSurf](const auto& e) { return e->m_surface == wlSurf; });
if (existing != m_surfaces.end()) {
- Debug::log(WARN, "[xwm] associate() called but surface is already associated to {:x}, ignoring...", rc<uintptr_t>(surf.get()));
+ Log::logger->log(Log::WARN, "[xwm] associate() called but surface is already associated to {:x}, ignoring...", rc<uintptr_t>(surf.get()));
return;
}
@@ -1169,7 +1170,7 @@ void CXWM::dissociate(SP<CXWaylandSurface> surf) {
surf->m_surface.reset();
surf->m_events.resourceChange.emit();
- Debug::log(LOG, "Dissociate for {:x}", rc<uintptr_t>(surf.get()));
+ Log::logger->log(Log::DEBUG, "Dissociate for {:x}", rc<uintptr_t>(surf.get()));
}
void CXWM::updateClientList() {
@@ -1259,13 +1260,13 @@ void CXWM::initSelection() {
void CXWM::setClipboardToWayland(SXSelection& sel) {
auto source = makeShared<CXDataSource>(sel);
if (source->mimes().empty()) {
- Debug::log(ERR, "[xwm] can't set selection: no MIMEs");
+ Log::logger->log(Log::ERR, "[xwm] can't set selection: no MIMEs");
return;
}
sel.dataSource = source;
- Debug::log(LOG, "[xwm] X selection at {:x} takes {}", rc<uintptr_t>(sel.dataSource.get()), (&sel == &m_clipboard) ? "clipboard" : "primary selection");
+ Log::logger->log(Log::DEBUG, "[xwm] X selection at {:x} takes {}", rc<uintptr_t>(sel.dataSource.get()), (&sel == &m_clipboard) ? "clipboard" : "primary selection");
if (&sel == &m_clipboard)
g_pSeatManager->setCurrentSelection(sel.dataSource);
@@ -1279,29 +1280,29 @@ static int writeDataSource(int fd, uint32_t mask, void* data) {
}
void CXWM::getTransferData(SXSelection& sel) {
- Debug::log(LOG, "[xwm] getTransferData");
+ Log::logger->log(Log::DEBUG, "[xwm] getTransferData");
auto it = std::ranges::find_if(sel.transfers, [](const auto& t) { return !t->propertyReply; });
if (it == sel.transfers.end()) {
- Debug::log(ERR, "[xwm] No pending transfer found");
+ Log::logger->log(Log::ERR, "[xwm] No pending transfer found");
return;
}
auto& transfer = *it;
if (!transfer || !transfer->incomingWindow) {
- Debug::log(ERR, "[xwm] Invalid transfer state");
+ Log::logger->log(Log::ERR, "[xwm] Invalid transfer state");
sel.transfers.erase(it);
return;
}
if (!transfer->getIncomingSelectionProp(true)) {
- Debug::log(ERR, "[xwm] Failed to get property data");
+ Log::logger->log(Log::ERR, "[xwm] Failed to get property data");
sel.transfers.erase(it);
return;
}
if (!transfer->propertyReply) {
- Debug::log(ERR, "[xwm] No property reply");
+ Log::logger->log(Log::ERR, "[xwm] No property reply");
sel.transfers.erase(it);
return;
}
@@ -1335,7 +1336,7 @@ void CXWM::getTransferData(SXSelection& sel) {
void CXWM::setCursor(unsigned char* pixData, uint32_t stride, const Vector2D& size, const Vector2D& hotspot) {
if (!m_renderFormatID) {
- Debug::log(ERR, "[xwm] can't set cursor: no render format");
+ Log::logger->log(Log::ERR, "[xwm] can't set cursor: no render format");
return;
}
@@ -1374,7 +1375,7 @@ SP<IDataOffer> CXWM::createX11DataOffer(SP<CWLSurfaceResource> surf, SP<IDataSou
auto XSURF = windowForWayland(surf);
if (!XSURF) {
- Debug::log(ERR, "[xwm] No xwayland surface for destination in createX11DataOffer");
+ Log::logger->log(Log::ERR, "[xwm] No xwayland surface for destination in createX11DataOffer");
return nullptr;
}
@@ -1432,7 +1433,7 @@ int SXSelection::onRead(int fd, uint32_t mask) {
auto it = std::ranges::find_if(transfers, [fd](const auto& t) { return t->wlFD.get() == fd; });
if (it == transfers.end()) {
- Debug::log(ERR, "[xwm] No transfer found for fd {}", fd);
+ Log::logger->log(Log::ERR, "[xwm] No transfer found for fd {}", fd);
return 0;
}
@@ -1443,7 +1444,7 @@ int SXSelection::onRead(int fd, uint32_t mask) {
ssize_t bytesRead = read(fd, transfer->data.data() + oldSize, INCR_CHUNK_SIZE - 1);
if (bytesRead < 0) {
- Debug::log(ERR, "[xwm] readDataSource died");
+ Log::logger->log(Log::ERR, "[xwm] readDataSource died");
g_pXWayland->m_wm->selectionSendNotify(&transfer->request, false);
transfers.erase(it);
return 0;
@@ -1453,13 +1454,13 @@ int SXSelection::onRead(int fd, uint32_t mask) {
if (bytesRead == 0) {
if (transfer->data.empty()) {
- Debug::log(WARN, "[xwm] Transfer ended with zero bytes — rejecting");
+ Log::logger->log(Log::WARN, "[xwm] Transfer ended with zero bytes — rejecting");
g_pXWayland->m_wm->selectionSendNotify(&transfer->request, false);
transfers.erase(it);
return 0;
}
- Debug::log(LOG, "[xwm] Transfer complete, total size: {}", transfer->data.size());
+ Log::logger->log(Log::DEBUG, "[xwm] Transfer complete, total size: {}", transfer->data.size());
auto conn = g_pXWayland->m_wm->getConnection();
xcb_change_property(conn, XCB_PROP_MODE_REPLACE, transfer->request.requestor, transfer->request.property, transfer->request.target, 8, transfer->data.size(),
transfer->data.data());
@@ -1468,13 +1469,13 @@ int SXSelection::onRead(int fd, uint32_t mask) {
g_pXWayland->m_wm->selectionSendNotify(&transfer->request, true);
transfers.erase(it);
} else
- Debug::log(LOG, "[xwm] Received {} bytes, awaiting more...", bytesRead);
+ Log::logger->log(Log::DEBUG, "[xwm] Received {} bytes, awaiting more...", bytesRead);
return 1;
}
static int readDataSource(int fd, uint32_t mask, void* data) {
- Debug::log(LOG, "[xwm] readDataSource on fd {}", fd);
+ Log::logger->log(Log::DEBUG, "[xwm] readDataSource on fd {}", fd);
auto selection = sc<SXSelection*>(data);
@@ -1491,30 +1492,30 @@ bool SXSelection::sendData(xcb_selection_request_event_t* e, std::string mime) {
selection = g_pXWayland->m_wm->m_dndDataOffers.at(0)->getSource();
if (!selection) {
- Debug::log(ERR, "[xwm] sendData: no selection source available");
+ Log::logger->log(Log::ERR, "[xwm] sendData: no selection source available");
return false;
}
const auto MIMES = selection->mimes();
if (MIMES.empty()) {
- Debug::log(ERR, "[xwm] sendData: selection source has no mimes");
+ Log::logger->log(Log::ERR, "[xwm] sendData: selection source has no mimes");
return false;
}
if (std::ranges::find(MIMES, mime) == MIMES.end()) {
// try to guess mime, don't just blindly send random-ass shit that the app will have no fucking
// clue what to do with
- Debug::log(ERR, "[xwm] X client asked for MIME '{}' that this selection doesn't support, guessing.", mime);
+ Log::logger->log(Log::ERR, "[xwm] X client asked for MIME '{}' that this selection doesn't support, guessing.", mime);
auto needle = mime;
auto selectedMime = *MIMES.begin();
if (mime.contains('/'))
needle = mime.substr(0, mime.find('/'));
- Debug::log(TRACE, "[xwm] X MIME needle '{}'", needle);
+ Log::logger->log(Log::TRACE, "[xwm] X MIME needle '{}'", needle);
- if (Debug::m_trace) {
+ if (Env::isTrace()) {
std::string mimeList = "";
for (const auto& m : MIMES) {
mimeList += "'" + m + "', ";
@@ -1523,7 +1524,7 @@ bool SXSelection::sendData(xcb_selection_request_event_t* e, std::string mime) {
if (!MIMES.empty())
mimeList = mimeList.substr(0, mimeList.size() - 2);
- Debug::log(TRACE, "[xwm] X MIME supported: {}", mimeList);
+ Log::logger->log(Log::TRACE, "[xwm] X MIME supported: {}", mimeList);
}
bool found = false;
@@ -1531,7 +1532,7 @@ bool SXSelection::sendData(xcb_selection_request_event_t* e, std::string mime) {
for (const auto& m : MIMES) {
if (m.starts_with(needle)) {
selectedMime = m;
- Debug::log(TRACE, "[xwm] X MIME needle found type '{}'", m);
+ Log::logger->log(Log::TRACE, "[xwm] X MIME needle found type '{}'", m);
found = true;
break;
}
@@ -1541,14 +1542,14 @@ bool SXSelection::sendData(xcb_selection_request_event_t* e, std::string mime) {
for (const auto& m : MIMES) {
if (m.contains(needle)) {
selectedMime = m;
- Debug::log(TRACE, "[xwm] X MIME needle found type '{}'", m);
+ Log::logger->log(Log::TRACE, "[xwm] X MIME needle found type '{}'", m);
found = true;
break;
}
}
}
- Debug::log(ERR, "[xwm] Guessed mime: '{}'. Hopefully we're right enough.", selectedMime);
+ Log::logger->log(Log::ERR, "[xwm] Guessed mime: '{}'. Hopefully we're right enough.", selectedMime);
mime = selectedMime;
}
@@ -1558,7 +1559,7 @@ bool SXSelection::sendData(xcb_selection_request_event_t* e, std::string mime) {
int p[2];
if (pipe(p) == -1) {
- Debug::log(ERR, "[xwm] sendData: pipe() failed");
+ Log::logger->log(Log::ERR, "[xwm] sendData: pipe() failed");
return false;
}
@@ -1569,7 +1570,7 @@ bool SXSelection::sendData(xcb_selection_request_event_t* e, std::string mime) {
transfer->wlFD = CFileDescriptor{p[0]};
- Debug::log(LOG, "[xwm] sending wayland selection to xwayland with mime {}, target {}, fds {} {}", mime, e->target, p[0], p[1]);
+ Log::logger->log(Log::DEBUG, "[xwm] sending wayland selection to xwayland with mime {}, target {}, fds {} {}", mime, e->target, p[0], p[1]);
selection->send(mime, CFileDescriptor{p[1]});
@@ -1582,7 +1583,7 @@ bool SXSelection::sendData(xcb_selection_request_event_t* e, std::string mime) {
int SXSelection::onWrite() {
auto it = std::ranges::find_if(transfers, [](const auto& t) { return t->propertyReply; });
if (it == transfers.end()) {
- Debug::log(ERR, "[xwm] No transfer with property data found");
+ Log::logger->log(Log::ERR, "[xwm] No transfer with property data found");
return 0;
}
@@ -1594,16 +1595,16 @@ int SXSelection::onWrite() {
if (len == -1) {
if (errno == EAGAIN)
return 1;
- Debug::log(ERR, "[xwm] write died in transfer get");
+ Log::logger->log(Log::ERR, "[xwm] write died in transfer get");
transfers.erase(it);
return 0;
}
if (len < remainder) {
transfer->propertyStart += len;
- Debug::log(LOG, "[xwm] wl client read partially: len {}", len);
+ Log::logger->log(Log::DEBUG, "[xwm] wl client read partially: len {}", len);
} else {
- Debug::log(LOG, "[xwm] cb transfer to wl client complete, read {} bytes", len);
+ Log::logger->log(Log::DEBUG, "[xwm] cb transfer to wl client complete, read {} bytes", len);
if (!transfer->incremental) {
transfers.erase(it);
} else {
@@ -1633,7 +1634,7 @@ bool SXTransfer::getIncomingSelectionProp(bool erase) {
propertyReply = xcb_get_property_reply(*g_pXWayland->m_wm->m_connection, cookie, nullptr);
if (!propertyReply) {
- Debug::log(ERR, "[SXTransfer] couldn't get a prop reply");
+ Log::logger->log(Log::ERR, "[SXTransfer] couldn't get a prop reply");
return false;
}
diff --git a/src/xwayland/XWM.hpp b/src/xwayland/XWM.hpp
index b328a2c9..1a922a45 100644
--- a/src/xwayland/XWM.hpp
+++ b/src/xwayland/XWM.hpp
@@ -71,11 +71,11 @@ class CXCBConnection {
~CXCBConnection() {
if (m_connection) {
- Debug::log(LOG, "Disconnecting XCB connection {:x}", rc<uintptr_t>(m_connection));
+ Log::logger->log(Log::DEBUG, "Disconnecting XCB connection {:x}", rc<uintptr_t>(m_connection));
xcb_disconnect(m_connection);
m_connection = nullptr;
} else
- Debug::log(ERR, "Double xcb_disconnect attempt");
+ Log::logger->log(Log::ERR, "Double xcb_disconnect attempt");
}
bool hasError() const {
diff --git a/src/xwayland/XWayland.cpp b/src/xwayland/XWayland.cpp
index f7bdf1e6..a022217a 100644
--- a/src/xwayland/XWayland.cpp
+++ b/src/xwayland/XWayland.cpp
@@ -1,13 +1,13 @@
#include "XWayland.hpp"
#include "../Compositor.hpp"
-#include "../debug/Log.hpp"
+#include "../debug/log/Logger.hpp"
#include "../helpers/fs/FsUtils.hpp"
CXWayland::CXWayland(const bool wantsEnabled) {
#ifndef NO_XWAYLAND
// Disable Xwayland and clean up if the user disabled it.
if (!wantsEnabled) {
- Debug::log(LOG, "XWayland has been disabled, cleaning up...");
+ Log::logger->log(Log::DEBUG, "XWayland has been disabled, cleaning up...");
for (auto& w : g_pCompositor->m_windows) {
if (!w->m_isX11)
continue;
@@ -20,29 +20,29 @@ CXWayland::CXWayland(const bool wantsEnabled) {
if (!NFsUtils::executableExistsInPath("Xwayland")) {
// If Xwayland doesn't exist, don't try to start it.
- Debug::log(LOG, "Unable to find XWayland; not starting it.");
+ Log::logger->log(Log::DEBUG, "Unable to find XWayland; not starting it.");
return;
}
- Debug::log(LOG, "Starting up the XWayland server");
+ Log::logger->log(Log::DEBUG, "Starting up the XWayland server");
m_server = makeUnique<CXWaylandServer>();
if (!m_server->create()) {
- Debug::log(ERR, "XWayland failed to start: it will not work.");
+ Log::logger->log(Log::ERR, "XWayland failed to start: it will not work.");
return;
}
m_enabled = true;
#else
- Debug::log(LOG, "Not starting XWayland: disabled at compile time");
+ Log::logger->log(Log::DEBUG, "Not starting XWayland: disabled at compile time");
#endif
}
void CXWayland::setCursor(unsigned char* pixData, uint32_t stride, const Vector2D& size, const Vector2D& hotspot) {
#ifndef NO_XWAYLAND
if (!m_wm) {
- Debug::log(ERR, "Couldn't set XCursor: no XWM yet");
+ Log::logger->log(Log::ERR, "Couldn't set XCursor: no XWM yet");
return;
}