Tidied structure of all classes within the entire code base
Also some other small bits of tidying
This commit is contained in:
@@ -1,10 +1,23 @@
|
||||
#include "Logger.hpp"
|
||||
|
||||
#include <iostream>
|
||||
#include <thread>
|
||||
|
||||
using namespace Bloom;
|
||||
|
||||
void Logger::configure(ApplicationConfig& applicationConfig) {
|
||||
if (applicationConfig.debugLoggingEnabled) {
|
||||
Logger::debugPrintingEnabled = true;
|
||||
Logger::debug("Debug log printing has been enabled.");
|
||||
}
|
||||
}
|
||||
|
||||
void Logger::silence() {
|
||||
Logger::debugPrintingEnabled = false;
|
||||
Logger::infoPrintingEnabled = false;
|
||||
Logger::errorPrintingEnabled = false;
|
||||
Logger::warningPrintingEnabled = false;
|
||||
}
|
||||
|
||||
void Logger::log(const std::string& message, LogLevel logLevel, bool print) {
|
||||
auto lock = std::unique_lock(Logger::logMutex);
|
||||
auto logEntry = LogEntry(message, logLevel);
|
||||
@@ -51,17 +64,3 @@ void Logger::log(const std::string& message, LogLevel logLevel, bool print) {
|
||||
std::cout << logEntry.message << "\033[0m" << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
void Logger::configure(ApplicationConfig& applicationConfig) {
|
||||
if (applicationConfig.debugLoggingEnabled) {
|
||||
Logger::debugPrintingEnabled = true;
|
||||
Logger::debug("Debug log printing has been enabled.");
|
||||
}
|
||||
}
|
||||
|
||||
void Logger::silence() {
|
||||
Logger::debugPrintingEnabled = false;
|
||||
Logger::infoPrintingEnabled = false;
|
||||
Logger::errorPrintingEnabled = false;
|
||||
Logger::warningPrintingEnabled = false;
|
||||
}
|
||||
|
||||
@@ -52,23 +52,11 @@ namespace Bloom
|
||||
*/
|
||||
class Logger
|
||||
{
|
||||
private:
|
||||
/**
|
||||
* We keep a record of every log entry for future processing. Maybe dumping to a file or something
|
||||
* of that nature when a fatal error occurs.
|
||||
*/
|
||||
static inline std::vector<LogEntry> logEntries;
|
||||
|
||||
static inline bool errorPrintingEnabled = true;
|
||||
static inline bool warningPrintingEnabled = true;
|
||||
static inline bool infoPrintingEnabled = true;
|
||||
static inline bool debugPrintingEnabled = false;
|
||||
|
||||
static inline std::mutex logMutex;
|
||||
|
||||
static void log(const std::string& message, LogLevel logLevel, bool print);
|
||||
|
||||
public:
|
||||
static void configure(ApplicationConfig& applicationConfig);
|
||||
|
||||
static void silence();
|
||||
|
||||
static void setInfoPrinting(bool enabled) {
|
||||
Logger::infoPrintingEnabled = enabled;
|
||||
}
|
||||
@@ -97,8 +85,20 @@ namespace Bloom
|
||||
Logger::log(message, LogLevel::DEBUG, Logger::debugPrintingEnabled);
|
||||
}
|
||||
|
||||
static void configure(ApplicationConfig& applicationConfig);
|
||||
private:
|
||||
/**
|
||||
* We keep a record of every log entry for future processing. Maybe dumping to a file or something
|
||||
* of that nature when a fatal error occurs.
|
||||
*/
|
||||
static inline std::vector<LogEntry> logEntries;
|
||||
|
||||
static void silence();
|
||||
static inline bool errorPrintingEnabled = true;
|
||||
static inline bool warningPrintingEnabled = true;
|
||||
static inline bool infoPrintingEnabled = true;
|
||||
static inline bool debugPrintingEnabled = false;
|
||||
|
||||
static inline std::mutex logMutex;
|
||||
|
||||
static void log(const std::string& message, LogLevel logLevel, bool print);
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user