diff --git a/CMakeLists.txt b/CMakeLists.txt index 9686332f..b88e9aef 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,6 +7,7 @@ PROJECT(sioclient option(BUILD_SHARED_LIBS "Build the shared library" OFF) option(BUILD_UNIT_TESTS "Builds unit tests target" OFF) option(USE_SUBMODULES "Use source in local submodules instead of system libraries" ON) +option(DISABLE_LOGGING "Do not print logging messages" OFF) if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) set(DEFAULT_BUILD_TYPE "Release") @@ -39,6 +40,10 @@ add_definitions( -D_WEBSOCKETPP_CPP11_CHRONO_ ) +if (DISABLE_LOGGING) + add_definitions(-DSIO_DISABLE_LOGGING) +endif() + set(ALL_SRC "src/sio_client.cpp" "src/sio_socket.cpp" diff --git a/src/internal/sio_client_impl.cpp b/src/internal/sio_client_impl.cpp index 91dad3d6..efda7f54 100644 --- a/src/internal/sio_client_impl.cpp +++ b/src/internal/sio_client_impl.cpp @@ -13,7 +13,7 @@ #include #include // Comment this out to disable handshake logging to stdout -#if DEBUG || _DEBUG +#if (DEBUG || _DEBUG) && !defined(SIO_DISABLE_LOGGING) #define LOG(x) std::cout << x #else #define LOG(x)