Go to the documentation of this file.00001 #include "../pch.h"
00002
00003 CmdLogger::CmdLogger(){
00004 AllocConsole();
00005 freopen_s(&file, "CONOUT$", "w", stdout);
00006 }
00007
00008 CmdLogger::~CmdLogger(){
00009 fclose(file);
00010 FreeConsole();
00011 }
00012
00013 void CmdLogger::print(const wchar* text){
00014 #ifdef UNICODE
00015 wprintf_s(TEXT("%s"), text);
00016 #else
00017 printf_s("%s", text);
00018 #endif
00019 }
00020
00021 void CmdLogger::print(const wchar* text, const char* file, const int line){
00022 printf_s("%s(%d) ", file, line);
00023 #ifdef UNICODE
00024 wprintf_s(TEXT("%s"), text);
00025 #else
00026 printf_s("%s", text);
00027 #endif
00028 }
00029
00030 void CmdLogger::println(const wchar* text){
00031 #ifdef UNICODE
00032 wprintf_s(TEXT("%s\n"), text);
00033 #else
00034 printf_s("%s\n", text);
00035 #endif
00036 }
00037
00038 void CmdLogger::println(const wchar* text, const char* file, const int line){
00039 printf_s("%s(%d) ", file, line);
00040 #ifdef UNICODE
00041 wprintf_s(TEXT("%s\n"), text);
00042 #else
00043 printf_s("%s\n", text);
00044 #endif
00045 }
00046
00047 DummyLogger::DummyLogger(){
00048 }
00049
00050 DummyLogger::~DummyLogger(){
00051 }
00052
00053 void DummyLogger::print(const wchar* text){
00054 }
00055
00056 void DummyLogger::print(const wchar* text, const char* file, const int line){
00057 }
00058
00059 void DummyLogger::println(const wchar* text){
00060 }
00061
00062 void DummyLogger::println(const wchar* text, const char* file, const int line){
00063 }