mirror of
https://github.com/Trensa-Organization/Hyprland.git
synced 2025-03-17 03:33:39 +01:00
29 lines
669 B
C++
29 lines
669 B
C++
#include "Log.hpp"
|
|
#include "../defines.hpp"
|
|
#include "../Compositor.hpp"
|
|
|
|
#include <fstream>
|
|
#include <iostream>
|
|
|
|
void Debug::init(const std::string& IS) {
|
|
logFile = "/tmp/hypr/" + IS + (ISDEBUG ? "/hyprlandd.log" : "/hyprland.log");
|
|
}
|
|
|
|
void Debug::wlrLog(wlr_log_importance level, const char* fmt, va_list args) {
|
|
char* outputStr = nullptr;
|
|
|
|
std::ofstream ofs;
|
|
ofs.open(logFile, std::ios::out | std::ios::app);
|
|
|
|
vasprintf(&outputStr, fmt, args);
|
|
|
|
std::string output = std::string(outputStr);
|
|
free(outputStr);
|
|
|
|
ofs << "[wlr] " << output << "\n";
|
|
|
|
ofs.close();
|
|
|
|
if (!disableStdout)
|
|
std::cout << output << "\n";
|
|
}
|