From 999fd20ca96b8d44d3ce418f118fb3b846038978 Mon Sep 17 00:00:00 2001 From: Jason Maskell Date: Tue, 31 May 2016 11:24:52 +0200 Subject: Added support for RFC 104, the logging interface: https://docs.google.com/document/d/102b8k5pKYj9e-tMmG53aT5izur-qfUSPX1gBro4gN0Q/edit Added a dumb implementation of the logger in the D3D11 sample. Added a method to the WaveWorks API to allow the user to set (override) the internal logger with their own supplied nv::ILogger derived object. --- common/LoggerImpl.cpp | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 common/LoggerImpl.cpp (limited to 'common/LoggerImpl.cpp') diff --git a/common/LoggerImpl.cpp b/common/LoggerImpl.cpp new file mode 100644 index 0000000..9a2921d --- /dev/null +++ b/common/LoggerImpl.cpp @@ -0,0 +1,46 @@ +#include "LoggerImpl.h" +#include +#include +#include + +LoggerWWSamples* g_Logger = nullptr; + +LoggerWWSamples::LoggerWWSamples(): +LoggingLevel(nv::LogSeverity::kInfo) +{ + +} + +LoggerWWSamples::LoggerWWSamples(nv::LogSeverity loggingLevel) : + LoggingLevel(loggingLevel) +{ + +} + +nv::LogSeverity LoggerWWSamples::getLoggingLevel() +{ + return LoggingLevel; +} + +void LoggerWWSamples::setLoggingLevel(nv::LogSeverity newLevel) +{ + LoggingLevel = newLevel; +} + +void LoggerWWSamples::log(const char* text, nv::LogSeverity severity, const char* filename, int linenumber) +{ + std::ostringstream out; + + out << filename << "(" << linenumber << "): " << "[" << nv::LogSeverityStrings[(int) severity] << "] " << text << std::endl; + + OutputDebugStringA(out.str().c_str()); +} + +void LoggerWWSamples::log(const wchar_t* text, nv::LogSeverity severity, const wchar_t* filename, int linenumber) +{ + std::wstringstream out; + + out << filename << "(" << linenumber << "): " << "[" << nv::LogSeverityStrings[(int)severity] << "] " << text << std::endl; + + OutputDebugStringW(out.str().c_str()); +} -- cgit v1.2.3