added debug:disable_logs

This commit is contained in:
vaxerski 2022-07-01 15:57:56 +02:00
parent 1750a7cdbb
commit 868e0f48d0
3 changed files with 7 additions and 0 deletions

View file

@ -15,6 +15,8 @@ CConfigManager::CConfigManager() {
static const char* const ENVHOME = getenv("HOME");
const std::string CONFIGPATH = ENVHOME + (ISDEBUG ? (std::string) "/.config/hypr/hyprlandd.conf" : (std::string) "/.config/hypr/hyprland.conf");
configPaths.emplace_back(CONFIGPATH);
Debug::disableLogs = &configValues["debug:disable_logs"].intValue;
}
void CConfigManager::setDefaultVars() {
@ -39,6 +41,7 @@ void CConfigManager::setDefaultVars() {
configValues["debug:log_damage"].intValue = 0;
configValues["debug:overlay"].intValue = 0;
configValues["debug:damage_blink"].intValue = 0;
configValues["debug:disable_logs"].intValue = 0;
configValues["decoration:rounding"].intValue = 1;
configValues["decoration:blur"].intValue = 1;

View file

@ -14,6 +14,9 @@ void Debug::init(std::string IS) {
void Debug::log(LogLevel level, const char* fmt, ...) {
if (disableLogs && *disableLogs)
return;
// log to a file
std::ofstream ofs;
ofs.open(logFile, std::ios::out | std::ios::app);

View file

@ -17,4 +17,5 @@ namespace Debug {
void log(LogLevel level, const char* fmt, ...);
inline std::string logFile;
inline int64_t* disableLogs = nullptr;
};