diff options
| author | Tom Englund <tomenglund26@gmail.com> | 2024-08-15 18:16:18 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-08-15 17:16:18 +0100 |
| commit | 12d9901472c6f9128fa8b16c25b3a879d1859e60 (patch) | |
| tree | dabd4f190454d95c5a20ad8e9c840d116e790157 /src/protocols/LinuxDMABUF.cpp | |
| parent | 15f942000ef53776852d6d9dfd303e691aed73e3 (diff) | |
protocols: refactor protocol logging to a macro (#7324)
this avoids the usage of the unique_ptr PROTO::protocol before it has
been constructed incase one wants to log something inside the
constructor itself, move the logging to macros and print file:linenumber
on ERR,CRIT,WARN and classname on the rest of the levels.
Diffstat (limited to 'src/protocols/LinuxDMABUF.cpp')
| -rw-r--r-- | src/protocols/LinuxDMABUF.cpp | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/protocols/LinuxDMABUF.cpp b/src/protocols/LinuxDMABUF.cpp index 0fbf832e..3cdb5b34 100644 --- a/src/protocols/LinuxDMABUF.cpp +++ b/src/protocols/LinuxDMABUF.cpp @@ -14,8 +14,6 @@ #include "../render/OpenGL.hpp" #include "../Compositor.hpp" -#define LOGM PROTO::linuxDma->protoLog - static std::optional<dev_t> devIDFromFD(int fd) { struct stat stat; if (fstat(fd, &stat) != 0) @@ -425,7 +423,7 @@ CLinuxDMABufV1Protocol::CLinuxDMABufV1Protocol(const wl_interface* iface, const auto dev = devIDFromFD(rendererFD); if (!dev.has_value()) { - protoLog(ERR, "failed to get drm dev, disabling linux dmabuf"); + LOGM(ERR, "failed to get drm dev, disabling linux dmabuf"); removeGlobal(); return; } @@ -477,7 +475,7 @@ CLinuxDMABufV1Protocol::CLinuxDMABufV1Protocol(const wl_interface* iface, const drmDevice* device = nullptr; if (drmGetDeviceFromDevId(mainDevice, 0, &device) != 0) { - protoLog(ERR, "failed to get drm dev, disabling linux dmabuf"); + LOGM(ERR, "failed to get drm dev, disabling linux dmabuf"); removeGlobal(); return; } @@ -487,12 +485,12 @@ CLinuxDMABufV1Protocol::CLinuxDMABufV1Protocol(const wl_interface* iface, const mainDeviceFD = open(name, O_RDWR | O_CLOEXEC); drmFreeDevice(&device); if (mainDeviceFD < 0) { - protoLog(ERR, "failed to open drm dev, disabling linux dmabuf"); + LOGM(ERR, "failed to open drm dev, disabling linux dmabuf"); removeGlobal(); return; } } else { - protoLog(ERR, "DRM device {} has no render node, disabling linux dmabuf", device->nodes[DRM_NODE_PRIMARY] ? device->nodes[DRM_NODE_PRIMARY] : "null"); + LOGM(ERR, "DRM device {} has no render node, disabling linux dmabuf", device->nodes[DRM_NODE_PRIMARY] ? device->nodes[DRM_NODE_PRIMARY] : "null"); drmFreeDevice(&device); removeGlobal(); } |
