format codebase

This commit is contained in:
aronwk-aaron
2022-07-28 08:39:57 -05:00
parent 4f7aa11067
commit 19e77a38d8
881 changed files with 34700 additions and 38689 deletions

View File

@@ -10,7 +10,7 @@ dLogger::dLogger(const std::string& outpath, bool logToConsole, bool logDebugSta
if (!mFile) { printf("Couldn't open %s for writing!\n", outpath.c_str()); }
#else
fp = fopen(outpath.c_str(), "wt");
if (fp == NULL) { printf("Couldn't open %s for writing!\n", outpath.c_str()); }
if (fp == NULL) { printf("Couldn't open %s for writing!\n", outpath.c_str()); }
#endif
}
@@ -46,42 +46,42 @@ void dLogger::vLog(const char* format, va_list args) {
mFile << "[" << timeStr << "] " << message;
#else
time_t t = time(NULL);
struct tm * time = localtime(&t);
char timeStr[70];
strftime(timeStr, sizeof(timeStr), "%d-%m-%y %H:%M:%S", time);
struct tm* time = localtime(&t);
char timeStr[70];
strftime(timeStr, sizeof(timeStr), "%d-%m-%y %H:%M:%S", time);
char message[2048];
vsprintf(message, format, args);
vsprintf(message, format, args);
if (m_logToConsole) {
if (m_logToConsole) {
fputs("[", stdout);
fputs(timeStr, stdout);
fputs("] ", stdout);
fputs(message, stdout);
}
}
if (fp != nullptr) {
if (fp != nullptr) {
fputs("[", fp);
fputs(timeStr, fp);
fputs("] ", fp);
fputs(message, fp);
} else {
printf("Logger not initialized!\n");
}
} else {
printf("Logger not initialized!\n");
}
#endif
}
void dLogger::LogBasic(const char * format, ...) {
void dLogger::LogBasic(const char* format, ...) {
va_list args;
va_start(args, format);
vLog(format, args);
va_end(args);
}
void dLogger::LogBasic(const std::string & message) {
void dLogger::LogBasic(const std::string& message) {
LogBasic(message.c_str());
}
void dLogger::Log(const char * className, const char * format, ...) {
void dLogger::Log(const char* className, const char* format, ...) {
va_list args;
std::string log = "[" + std::string(className) + "] " + std::string(format) + "\n";
va_start(args, format);
@@ -89,11 +89,11 @@ void dLogger::Log(const char * className, const char * format, ...) {
va_end(args);
}
void dLogger::Log(const std::string & className, const std::string & message) {
void dLogger::Log(const std::string& className, const std::string& message) {
Log(className.c_str(), message.c_str());
}
void dLogger::LogDebug(const char * className, const char * format, ...) {
void dLogger::LogDebug(const char* className, const char* format, ...) {
if (!m_logDebugStatements) return;
va_list args;
std::string log = "[" + std::string(className) + "] " + std::string(format);
@@ -102,7 +102,7 @@ void dLogger::LogDebug(const char * className, const char * format, ...) {
va_end(args);
}
void dLogger::LogDebug(const std::string & className, const std::string & message) {
void dLogger::LogDebug(const std::string& className, const std::string& message) {
LogDebug(className.c_str(), message.c_str());
}