summaryrefslogtreecommitdiff
path: root/src/debug/Log.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/debug/Log.cpp')
-rw-r--r--src/debug/Log.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/debug/Log.cpp b/src/debug/Log.cpp
index c2939831..0def77c0 100644
--- a/src/debug/Log.cpp
+++ b/src/debug/Log.cpp
@@ -8,6 +8,11 @@
void Debug::init(const std::string& IS) {
logFile = IS + (ISDEBUG ? "/hyprlandd.log" : "/hyprland.log");
+ logOfs.open(logFile, std::ios::out | std::ios::app);
+}
+
+void Debug::close() {
+ logOfs.close();
}
void Debug::log(LogLevel level, std::string str) {
@@ -55,11 +60,8 @@ void Debug::log(LogLevel level, std::string str) {
if (!disableLogs || !**disableLogs) {
// log to a file
- std::ofstream ofs;
- ofs.open(logFile, std::ios::out | std::ios::app);
- ofs << str << "\n";
-
- ofs.close();
+ logOfs << str << "\n";
+ logOfs.flush();
}
// log it to the stdout too.