mirror of
https://github.com/SantaSpeen/BeamMP-Server.git
synced 2025-08-18 12:15:36 +00:00
use RAII for log file open/close
This commit is contained in:
parent
cd19cd343a
commit
b62676daf4
@ -94,10 +94,8 @@ void DebugPrintTIDInternal(const std::string& func, bool overwrite) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void addToLog(const std::string& Line) {
|
void addToLog(const std::string& Line) {
|
||||||
std::ofstream LFS;
|
std::ofstream LFS("Server.log", std::ios_base::app);
|
||||||
LFS.open(("Server.log"), std::ios_base::app);
|
|
||||||
LFS << Line.c_str();
|
LFS << Line.c_str();
|
||||||
LFS.close();
|
|
||||||
}
|
}
|
||||||
void info(const std::string& toPrint) {
|
void info(const std::string& toPrint) {
|
||||||
std::scoped_lock Guard(LogLock);
|
std::scoped_lock Guard(LogLock);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user