dxvk/src/util/log/log.h

41 lines
741 B
C
Raw Normal View History

2017-10-10 22:32:13 +01:00
#pragma once
#include <fstream>
#include <iostream>
#include <mutex>
#include <string>
#include "../rc/util_rc.h"
namespace dxvk {
/**
* \brief Logger
*
2017-10-10 22:44:06 +01:00
* Logger for one DLL. Creates a text file and
* writes all log messages to that file.
2017-10-10 22:32:13 +01:00
*/
2017-10-10 22:44:06 +01:00
class Logger {
2017-10-10 22:32:13 +01:00
public:
2017-10-10 22:44:06 +01:00
Logger(const std::string& file_name);
~Logger();
2017-10-10 22:32:13 +01:00
2017-10-10 22:44:06 +01:00
static void trace(const std::string& message);
static void info (const std::string& message);
static void warn (const std::string& message);
static void err (const std::string& message);
2017-10-10 22:32:13 +01:00
private:
static Logger s_instance;
2017-10-10 22:32:13 +01:00
std::mutex m_mutex;
2017-10-10 22:44:06 +01:00
std::ofstream m_fileStream;
2017-10-10 22:32:13 +01:00
2017-10-10 22:44:06 +01:00
void log(const std::string& message);
2017-10-10 22:32:13 +01:00
};
}