diff options
| author | Jason Maskell <[email protected]> | 2016-05-31 11:24:52 +0200 |
|---|---|---|
| committer | Jason Maskell <[email protected]> | 2016-05-31 11:24:52 +0200 |
| commit | 999fd20ca96b8d44d3ce418f118fb3b846038978 (patch) | |
| tree | fc86969d4eb006f592560e7bd425b9a2db865be2 /common/LoggerImpl.cpp | |
| parent | Added path to opengl media search path. Removed commented out code left over ... (diff) | |
| download | waveworks_archive-999fd20ca96b8d44d3ce418f118fb3b846038978.tar.xz waveworks_archive-999fd20ca96b8d44d3ce418f118fb3b846038978.zip | |
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.
Diffstat (limited to 'common/LoggerImpl.cpp')
| -rw-r--r-- | common/LoggerImpl.cpp | 46 |
1 files changed, 46 insertions, 0 deletions
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 <iostream> +#include <sstream> +#include <windows.h> + +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()); +} |