feat(logging): add extra logging streams

This commit is contained in:
illyum 2024-09-15 04:32:46 -06:00
parent bf2847cc09
commit 6a11db9a2e

View File

@ -32,8 +32,14 @@ namespace ICEngine {
this->level = level; this->level = level;
} }
void AddStream(std::ostream * stream) {
this->streams.push_back(stream);
}
template<typename... Args> template<typename... Args>
void Log(LogLevel level, const char *file, int line, const char *func, const std::string &formatStr, Args &&... args) { void Log(LogLevel level, const char *file, int line, const char *func, const std::string &formatStr, Args &&... args) {
// TODO: Create a crash handler and manage fatal messages separately (creates crashdump)
// TODO: Allow user to create their own class that inherits Fatal Handler so they can implement it themselves
if (level < this->level) return; if (level < this->level) return;
std::string formattedMessage = format(formatStr, std::forward<Args>(args)...); std::string formattedMessage = format(formatStr, std::forward<Args>(args)...);
std::string logMessage = formatMessage(level, file, line, func, formattedMessage); std::string logMessage = formatMessage(level, file, line, func, formattedMessage);