fixed an oopsie and added logging to file

This commit is contained in:
vaxerski 2021-11-21 16:26:50 +01:00
parent ad05b0f8f6
commit 085261c205
3 changed files with 23 additions and 2 deletions

View file

@ -17,6 +17,14 @@ void ConfigManager::init() {
configValues["max_fps"].intValue = 60;
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) {

View file

@ -1,4 +1,5 @@
#include "Debug.hpp"
#include <fstream>
void Debug::log(LogLevel level, std::string msg) {
switch (level)
@ -23,4 +24,16 @@ void Debug::log(LogLevel level, std::string msg) {
break;
}
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();
}

View file

@ -91,7 +91,7 @@ bool CWindowManager::handleEvent() {
Debug::log(LOG, "Event dispatched MAP");
break;
case XCB_BUTTON_PRESS:
Events::eventButtonPress(ev);
Events::eventKeyPress(ev);
Debug::log(LOG, "Event dispatched BUTTON_PRESS");
break;
case XCB_EXPOSE:
@ -99,7 +99,7 @@ bool CWindowManager::handleEvent() {
Debug::log(LOG, "Event dispatched EXPOSE");
break;
case XCB_KEY_PRESS:
Events::eventKeyPress(ev);
Events::eventButtonPress(ev);
Debug::log(LOG, "Event dispatched KEY_PRESS");
break;