From b62676daf4ffdf9d8fab19faf36139330cad57fd Mon Sep 17 00:00:00 2001 From: Lion Kortlepel Date: Tue, 12 Jan 2021 10:55:02 +0100 Subject: [PATCH] use RAII for log file open/close --- src/logger.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/logger.cpp b/src/logger.cpp index 34d6a8f..2260b6e 100644 --- a/src/logger.cpp +++ b/src/logger.cpp @@ -94,10 +94,8 @@ void DebugPrintTIDInternal(const std::string& func, bool overwrite) { } void addToLog(const std::string& Line) { - std::ofstream LFS; - LFS.open(("Server.log"), std::ios_base::app); + std::ofstream LFS("Server.log", std::ios_base::app); LFS << Line.c_str(); - LFS.close(); } void info(const std::string& toPrint) { std::scoped_lock Guard(LogLock);