diff options
| author | davc0n <dconti.dev@gmail.com> | 2025-04-21 20:42:02 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-04-21 20:42:02 +0200 |
| commit | 400dd1607292165bccbafc4af7bce4855ac8a71c (patch) | |
| tree | 22ae7686c979713750825b56b5d56695d8f3b8a2 /src/debug/Log.cpp | |
| parent | a3b96961a2d89b0a2e213f9dcf755e4cab98ac1d (diff) | |
debug: refactor class member vars (#10130)
Diffstat (limited to 'src/debug/Log.cpp')
| -rw-r--r-- | src/debug/Log.cpp | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/src/debug/Log.cpp b/src/debug/Log.cpp index 9cf86345..b5865f0a 100644 --- a/src/debug/Log.cpp +++ b/src/debug/Log.cpp @@ -7,21 +7,21 @@ #include <fcntl.h> void Debug::init(const std::string& IS) { - logFile = IS + (ISDEBUG ? "/hyprlandd.log" : "/hyprland.log"); - logOfs.open(logFile, std::ios::out | std::ios::app); - auto handle = logOfs.native_handle(); + m_logFile = IS + (ISDEBUG ? "/hyprlandd.log" : "/hyprland.log"); + m_logOfs.open(m_logFile, std::ios::out | std::ios::app); + auto handle = m_logOfs.native_handle(); fcntl(handle, F_SETFD, FD_CLOEXEC); } void Debug::close() { - logOfs.close(); + m_logOfs.close(); } void Debug::log(eLogLevel level, std::string str) { - if (level == TRACE && !trace) + if (level == TRACE && !m_trace) return; - if (shuttingDown) + if (m_shuttingDown) return; std::string coloredStr = str; @@ -55,20 +55,20 @@ void Debug::log(eLogLevel level, std::string str) { } //NOLINTEND - rollingLog += str + "\n"; - if (rollingLog.size() > ROLLING_LOG_SIZE) - rollingLog = rollingLog.substr(rollingLog.size() - ROLLING_LOG_SIZE); + m_rollingLog += str + "\n"; + if (m_rollingLog.size() > ROLLING_LOG_SIZE) + m_rollingLog = m_rollingLog.substr(m_rollingLog.size() - ROLLING_LOG_SIZE); if (SRollingLogFollow::get().isRunning()) SRollingLogFollow::get().addLog(str); - if (!disableLogs || !**disableLogs) { + if (!m_disableLogs || !**m_disableLogs) { // log to a file - logOfs << str << "\n"; - logOfs.flush(); + m_logOfs << str << "\n"; + m_logOfs.flush(); } // log it to the stdout too. - if (!disableStdout) - std::println("{}", ((coloredLogs && !**coloredLogs) ? str : coloredStr)); + if (!m_disableStdout) + std::println("{}", ((m_coloredLogs && !**m_coloredLogs) ? str : coloredStr)); } |
