summaryrefslogtreecommitdiff
path: root/common/LoggerImpl.cpp
blob: 9a2921df09fb27d43c6c00c3e70a5c47ca861b56 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
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());
}