1
0
mirror of https://github.com/EduApps-CDG/OpenDX synced 2024-12-30 09:45:37 +01:00
OpenDX/src/util/log/log.cpp

39 lines
853 B
C++
Raw Normal View History

2017-10-10 23:32:13 +02:00
#include "log.h"
2017-10-10 23:44:06 +02:00
#include "../../dxvk/dxvk_main.h"
2017-10-10 23:32:13 +02:00
namespace dxvk {
2017-10-10 23:44:06 +02:00
Logger::Logger(const std::string& file_name)
: m_fileStream(file_name) { }
Logger::~Logger() { }
void Logger::trace(const std::string& message) {
s_instance.log(std::string("trace: ") + message);
2017-10-10 23:44:06 +02:00
}
void Logger::info(const std::string& message) {
s_instance.log(std::string("info: ") + message);
2017-10-10 23:44:06 +02:00
}
void Logger::warn(const std::string& message) {
s_instance.log(std::string("warn: ") + message);
2017-10-10 23:32:13 +02:00
}
2017-10-10 23:44:06 +02:00
void Logger::err(const std::string& message) {
s_instance.log(std::string("err: ") + message);
2017-10-10 23:32:13 +02:00
}
2017-10-10 23:44:06 +02:00
void Logger::log(const std::string& message) {
2017-10-10 23:32:13 +02:00
std::lock_guard<std::mutex> lock(m_mutex);
std::cerr << message << std::endl;
2017-10-10 23:44:06 +02:00
m_fileStream << message << std::endl;
m_fileStream.flush();
2017-10-10 23:32:13 +02:00
}
}