1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-01-09 04:46:07 +01:00
dxvk/src/util/log/log.h
Philip Rebohle ad6c45d6b1
[dxvk] Improve debuggability of shader compiler issues
When using DXVK_LOG_LEVEL=debug, the graphics pipeline manager now
prints the names of the shaders used by the pipeline. This shall
help debug driver crashes in vkCreate*Pipelines.
2018-02-07 16:44:30 +01:00

61 lines
1.1 KiB
C++

#pragma once
#include <fstream>
#include <iostream>
#include <mutex>
#include <string>
namespace dxvk {
enum class LogLevel : uint32_t {
Trace = 0,
Debug = 1,
Info = 2,
Warn = 3,
Error = 4,
None = 5,
};
/**
* \brief Logger
*
* Logger for one DLL. Creates a text file and
* writes all log messages to that file.
*/
class Logger {
public:
Logger(const std::string& file_name);
~Logger();
static void trace(const std::string& message);
static void debug(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);
static LogLevel logLevel() {
return s_instance.m_minLevel;
}
private:
static Logger s_instance;
const LogLevel m_minLevel;
std::mutex m_mutex;
std::ofstream m_fileStream;
void log(LogLevel level, const std::string& message);
static LogLevel getMinLogLevel();
static std::string getFileName(
const std::string& base);
};
}