more cleanup

This commit is contained in:
Anonymous275
2020-12-20 14:11:17 +02:00
parent 49dd577c36
commit 4b9742553a
33 changed files with 316 additions and 904 deletions
+12 -10
View File
@@ -1,7 +1,9 @@
Copyright (c) 2020 BeamMP-Server & BeamMP-Launcher Developers.
BeamMP Server code is not in the public domain and is not free software. One must be granted explicit permission by the copyright holder in order to modify or distribute any part of the source or binaries. Anything else is prohibited. Modified works may not be published and have be upstreamed to the official repository.
///
/// Created by Anonymous275 on 7/17/2020
///
#include "Security/Enc.h"
#include "Startup.h"
#include "Logger.h"
#include <fstream>
@@ -40,47 +42,47 @@ std::string getDate() {
}
void InitLog(){
std::ofstream LFS;
LFS.open (Sec("Launcher.log"));
LFS.open ("Launcher.log");
if(!LFS.is_open()){
error(Sec("logger file init failed!"));
error("logger file init failed!");
}else LFS.close();
}
void addToLog(const std::string& Line){
std::ofstream LFS;
LFS.open(Sec("Launcher.log"), std::ios_base::app);
LFS.open("Launcher.log", std::ios_base::app);
LFS << Line.c_str();
LFS.close();
}
void info(const std::string& toPrint) {
std::string Print = getDate() + Sec("[INFO] ") + toPrint + "\n";
std::string Print = getDate() + "[INFO] " + toPrint + "\n";
std::cout << Print;
addToLog(Print);
}
void debug(const std::string& toPrint) {
if(!Dev)return;
std::string Print = getDate() + Sec("[DEBUG] ") + toPrint + "\n";
std::string Print = getDate() + "[DEBUG] " + toPrint + "\n";
std::cout << Print;
addToLog(Print);
}
void warn(const std::string& toPrint){
std::string Print = getDate() + Sec("[WARN] ") + toPrint + "\n";
std::string Print = getDate() + "[WARN] " + toPrint + "\n";
std::cout << Print;
addToLog(Print);
}
void error(const std::string& toPrint) {
std::string Print = getDate() + Sec("[ERROR] ") + toPrint + "\n";
std::string Print = getDate() + "[ERROR] " + toPrint + "\n";
std::cout << Print;
addToLog(Print);
}
void fatal(const std::string& toPrint) {
std::string Print = getDate() + Sec("[FATAL] ") + toPrint + "\n";
std::string Print = getDate() + "[FATAL] " + toPrint + "\n";
std::cout << Print;
addToLog(Print);
std::this_thread::sleep_for(std::chrono::seconds(5));
_Exit(-1);
}
void except(const std::string& toPrint) {
std::string Print = getDate() + Sec("[EXCEP] ") + toPrint + "\n";
std::string Print = getDate() + "[EXCEP] " + toPrint + "\n";
std::cout << Print;
addToLog(Print);
}