2
0

PolyLogger.cpp 543 B

12345678910111213141516171819202122232425262728293031323334353637
  1. #include "PolyLogger.h"
  2. using namespace Polycode;
  3. void Logger::logw(const char *str) {
  4. std::wcout << str << std::endl;
  5. }
  6. void Logger::log(const char *format, ...) {
  7. va_list args;
  8. va_start(args, format);
  9. vfprintf(stderr, format, args);
  10. va_end(args);
  11. #ifdef MSVC
  12. #ifdef _DEBUG
  13. char buffer[4096];
  14. va_start(args, format);
  15. vsprintf(buffer, format, args);
  16. va_end(args);
  17. WCHAR wbuf[4096];
  18. int i = 0;
  19. while(buffer[i] != '\0') {
  20. wbuf[i] = (WCHAR)buffer[i];
  21. ++i;
  22. }
  23. wbuf[i] = L'\0';
  24. OutputDebugString(wbuf);
  25. #endif
  26. #endif
  27. }