summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorvaxerski <43317083+vaxerski@users.noreply.github.com>2022-07-01 15:57:56 +0200
committervaxerski <43317083+vaxerski@users.noreply.github.com>2022-07-01 15:57:56 +0200
commit868e0f48d023714a205acf071594983d22d1478c (patch)
treea9dd9de8569f3c9520e5b438324325144779f4f8 /src
parent1750a7cdbbccac32b7df2c9a672d5603740b4787 (diff)
added debug:disable_logs
Diffstat (limited to 'src')
-rw-r--r--src/config/ConfigManager.cpp3
-rw-r--r--src/debug/Log.cpp3
-rw-r--r--src/debug/Log.hpp1
3 files changed, 7 insertions, 0 deletions
diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp
index 26503f7e..f313b155 100644
--- a/src/config/ConfigManager.cpp
+++ b/src/config/ConfigManager.cpp
@@ -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;
diff --git a/src/debug/Log.cpp b/src/debug/Log.cpp
index a864f0d2..2fa4a127 100644
--- a/src/debug/Log.cpp
+++ b/src/debug/Log.cpp
@@ -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);
diff --git a/src/debug/Log.hpp b/src/debug/Log.hpp
index 814da421..bde9b820 100644
--- a/src/debug/Log.hpp
+++ b/src/debug/Log.hpp
@@ -17,4 +17,5 @@ namespace Debug {
void log(LogLevel level, const char* fmt, ...);
inline std::string logFile;
+ inline int64_t* disableLogs = nullptr;
}; \ No newline at end of file