diff options
Diffstat (limited to 'src/catch2/internal/catch_debug_console.cpp')
| -rw-r--r-- | src/catch2/internal/catch_debug_console.cpp | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/src/catch2/internal/catch_debug_console.cpp b/src/catch2/internal/catch_debug_console.cpp new file mode 100644 index 0000000..40dd0a6 --- /dev/null +++ b/src/catch2/internal/catch_debug_console.cpp @@ -0,0 +1,45 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 + +#include <catch2/internal/catch_debug_console.hpp> + +#include <catch2/internal/catch_config_android_logwrite.hpp> +#include <catch2/internal/catch_platform.hpp> +#include <catch2/internal/catch_windows_h_proxy.hpp> +#include <catch2/catch_user_config.hpp> +#include <catch2/internal/catch_stdstreams.hpp> + +#include <ostream> + +#if defined(CATCH_CONFIG_ANDROID_LOGWRITE) +#include <android/log.h> + + namespace Catch { + void writeToDebugConsole( std::string const& text ) { + __android_log_write( ANDROID_LOG_DEBUG, "Catch", text.c_str() ); + } + } + +#elif defined(CATCH_PLATFORM_WINDOWS) + + namespace Catch { + void writeToDebugConsole( std::string const& text ) { + ::OutputDebugStringA( text.c_str() ); + } + } + +#else + + namespace Catch { + void writeToDebugConsole( std::string const& text ) { + // !TBD: Need a version for Mac/ XCode and other IDEs + Catch::cout() << text; + } + } + +#endif // Platform |
