mirror of
https://github.com/hyprwm/Hypr.git
synced 2024-11-22 13:35:57 +01:00
fixed an oopsie and added logging to file
This commit is contained in:
parent
ad05b0f8f6
commit
085261c205
3 changed files with 23 additions and 2 deletions
|
@ -17,6 +17,14 @@ void ConfigManager::init() {
|
||||||
configValues["max_fps"].intValue = 60;
|
configValues["max_fps"].intValue = 60;
|
||||||
|
|
||||||
ConfigManager::loadConfigLoadVars();
|
ConfigManager::loadConfigLoadVars();
|
||||||
|
|
||||||
|
// Clear logs
|
||||||
|
std::ofstream logs;
|
||||||
|
const char* const ENVHOME = getenv("HOME");
|
||||||
|
const std::string DEBUGPATH = ENVHOME + (std::string) "/.hypr.log";
|
||||||
|
logs.open(DEBUGPATH, std::ios::out | std::ios::trunc);
|
||||||
|
logs << " ";
|
||||||
|
logs.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
void handleBind(const std::string& command, const std::string& value) {
|
void handleBind(const std::string& command, const std::string& value) {
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
#include "Debug.hpp"
|
#include "Debug.hpp"
|
||||||
|
#include <fstream>
|
||||||
|
|
||||||
void Debug::log(LogLevel level, std::string msg) {
|
void Debug::log(LogLevel level, std::string msg) {
|
||||||
switch (level)
|
switch (level)
|
||||||
|
@ -23,4 +24,16 @@ void Debug::log(LogLevel level, std::string msg) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
printf((msg + "\n").c_str());
|
printf((msg + "\n").c_str());
|
||||||
|
|
||||||
|
// also log to a file
|
||||||
|
const char* const ENVHOME = getenv("HOME");
|
||||||
|
|
||||||
|
const std::string DEBUGPATH = ENVHOME + (std::string) "/.hypr.log";
|
||||||
|
std::ofstream ofs;
|
||||||
|
|
||||||
|
ofs.open(DEBUGPATH, std::ios::out | std::ios::app);
|
||||||
|
|
||||||
|
ofs << msg << "\n";
|
||||||
|
|
||||||
|
ofs.close();
|
||||||
}
|
}
|
|
@ -91,7 +91,7 @@ bool CWindowManager::handleEvent() {
|
||||||
Debug::log(LOG, "Event dispatched MAP");
|
Debug::log(LOG, "Event dispatched MAP");
|
||||||
break;
|
break;
|
||||||
case XCB_BUTTON_PRESS:
|
case XCB_BUTTON_PRESS:
|
||||||
Events::eventButtonPress(ev);
|
Events::eventKeyPress(ev);
|
||||||
Debug::log(LOG, "Event dispatched BUTTON_PRESS");
|
Debug::log(LOG, "Event dispatched BUTTON_PRESS");
|
||||||
break;
|
break;
|
||||||
case XCB_EXPOSE:
|
case XCB_EXPOSE:
|
||||||
|
@ -99,7 +99,7 @@ bool CWindowManager::handleEvent() {
|
||||||
Debug::log(LOG, "Event dispatched EXPOSE");
|
Debug::log(LOG, "Event dispatched EXPOSE");
|
||||||
break;
|
break;
|
||||||
case XCB_KEY_PRESS:
|
case XCB_KEY_PRESS:
|
||||||
Events::eventKeyPress(ev);
|
Events::eventButtonPress(ev);
|
||||||
Debug::log(LOG, "Event dispatched KEY_PRESS");
|
Debug::log(LOG, "Event dispatched KEY_PRESS");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue