mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-01-18 02:52:10 +01:00
[util] Add generic Logger::log method
This commit is contained in:
parent
311748ee09
commit
267daeccad
@ -15,31 +15,36 @@ namespace dxvk {
|
||||
|
||||
|
||||
void Logger::trace(const std::string& message) {
|
||||
s_instance.log(LogLevel::Trace, message);
|
||||
s_instance.emitMsg(LogLevel::Trace, message);
|
||||
}
|
||||
|
||||
|
||||
void Logger::debug(const std::string& message) {
|
||||
s_instance.log(LogLevel::Debug, message);
|
||||
s_instance.emitMsg(LogLevel::Debug, message);
|
||||
}
|
||||
|
||||
|
||||
void Logger::info(const std::string& message) {
|
||||
s_instance.log(LogLevel::Info, message);
|
||||
s_instance.emitMsg(LogLevel::Info, message);
|
||||
}
|
||||
|
||||
|
||||
void Logger::warn(const std::string& message) {
|
||||
s_instance.log(LogLevel::Warn, message);
|
||||
s_instance.emitMsg(LogLevel::Warn, message);
|
||||
}
|
||||
|
||||
|
||||
void Logger::err(const std::string& message) {
|
||||
s_instance.log(LogLevel::Error, message);
|
||||
s_instance.emitMsg(LogLevel::Error, message);
|
||||
}
|
||||
|
||||
|
||||
void Logger::log(LogLevel level, const std::string& message) {
|
||||
s_instance.emitMsg(level, message);
|
||||
}
|
||||
|
||||
|
||||
void Logger::emitMsg(LogLevel level, const std::string& message) {
|
||||
if (level >= m_minLevel) {
|
||||
std::lock_guard<std::mutex> lock(m_mutex);
|
||||
|
||||
|
@ -35,6 +35,7 @@ namespace dxvk {
|
||||
static void info (const std::string& message);
|
||||
static void warn (const std::string& message);
|
||||
static void err (const std::string& message);
|
||||
static void log (LogLevel level, const std::string& message);
|
||||
|
||||
static LogLevel logLevel() {
|
||||
return s_instance.m_minLevel;
|
||||
@ -49,7 +50,7 @@ namespace dxvk {
|
||||
std::mutex m_mutex;
|
||||
std::ofstream m_fileStream;
|
||||
|
||||
void log(LogLevel level, const std::string& message);
|
||||
void emitMsg(LogLevel level, const std::string& message);
|
||||
|
||||
static LogLevel getMinLogLevel();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user