catch_debug_console.cpp 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. /*
  2. * Created by Martin on 29/08/2017.
  3. *
  4. * Distributed under the Boost Software License, Version 1.0. (See accompanying
  5. * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  6. *
  7. */
  8. #include "catch_debug_console.h"
  9. #include "catch_compiler_capabilities.h"
  10. #include "catch_stream.h"
  11. #include "catch_platform.h"
  12. #include "catch_windows_h_proxy.h"
  13. #if defined(CATCH_CONFIG_ANDROID_LOGWRITE)
  14. #include <android/log.h>
  15. namespace Catch {
  16. void writeToDebugConsole( std::string const& text ) {
  17. __android_log_write( ANDROID_LOG_DEBUG, "Catch", text.c_str() );
  18. }
  19. }
  20. #elif defined(CATCH_PLATFORM_WINDOWS)
  21. namespace Catch {
  22. void writeToDebugConsole( std::string const& text ) {
  23. ::OutputDebugStringA( text.c_str() );
  24. }
  25. }
  26. #else
  27. namespace Catch {
  28. void writeToDebugConsole( std::string const& text ) {
  29. // !TBD: Need a version for Mac/ XCode and other IDEs
  30. Catch::cout() << text;
  31. }
  32. }
  33. #endif // Platform