mirror of
https://github.com/hyprwm/Hyprland.git
synced 2025-08-07 07:31:53 -07:00
added time logging
This commit is contained in:
@@ -24,6 +24,7 @@ CConfigManager::CConfigManager() {
|
|||||||
configPaths.emplace_back(CONFIGPATH);
|
configPaths.emplace_back(CONFIGPATH);
|
||||||
|
|
||||||
Debug::disableLogs = &configValues["debug:disable_logs"].intValue;
|
Debug::disableLogs = &configValues["debug:disable_logs"].intValue;
|
||||||
|
Debug::disableTime = &configValues["debug:disable_time"].intValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CConfigManager::setDefaultVars() {
|
void CConfigManager::setDefaultVars() {
|
||||||
@@ -55,6 +56,7 @@ void CConfigManager::setDefaultVars() {
|
|||||||
configValues["debug:overlay"].intValue = 0;
|
configValues["debug:overlay"].intValue = 0;
|
||||||
configValues["debug:damage_blink"].intValue = 0;
|
configValues["debug:damage_blink"].intValue = 0;
|
||||||
configValues["debug:disable_logs"].intValue = 0;
|
configValues["debug:disable_logs"].intValue = 0;
|
||||||
|
configValues["debug:disable_time"].intValue = 1;
|
||||||
|
|
||||||
configValues["decoration:rounding"].intValue = 1;
|
configValues["decoration:rounding"].intValue = 1;
|
||||||
configValues["decoration:blur"].intValue = 1;
|
configValues["decoration:blur"].intValue = 1;
|
||||||
|
@@ -41,6 +41,23 @@ void Debug::log(LogLevel level, const char* fmt, ...) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// print date and time to the ofs
|
||||||
|
if (disableTime && !*disableTime) {
|
||||||
|
auto timet = std::chrono::system_clock::to_time_t(std::chrono::system_clock::now());
|
||||||
|
const auto MILLIS = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch()).count() % 1000;
|
||||||
|
|
||||||
|
ofs << std::put_time(std::localtime(&timet), "[%H:%M:%S:");
|
||||||
|
|
||||||
|
if (MILLIS > 99)
|
||||||
|
ofs << MILLIS;
|
||||||
|
else if (MILLIS > 9)
|
||||||
|
ofs << "0" << MILLIS;
|
||||||
|
else
|
||||||
|
ofs << "00" << MILLIS;
|
||||||
|
|
||||||
|
ofs << "] ";
|
||||||
|
}
|
||||||
|
|
||||||
char buf[LOGMESSAGESIZE] = "";
|
char buf[LOGMESSAGESIZE] = "";
|
||||||
char* outputStr;
|
char* outputStr;
|
||||||
int logLen;
|
int logLen;
|
||||||
|
@@ -18,4 +18,5 @@ namespace Debug {
|
|||||||
|
|
||||||
inline std::string logFile;
|
inline std::string logFile;
|
||||||
inline int64_t* disableLogs = nullptr;
|
inline int64_t* disableLogs = nullptr;
|
||||||
|
inline int64_t* disableTime = nullptr;
|
||||||
};
|
};
|
Reference in New Issue
Block a user