Skip to content

Commit

Permalink
feat: allow disabling the logging of the library (#399)
Browse files Browse the repository at this point in the history
  • Loading branch information
jmigual committed Jun 26, 2023
1 parent 9d55f6e commit 75e0589
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion src/internal/sio_client_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include <mutex>
#include <cmath>
// 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)
Expand Down

0 comments on commit 75e0589

Please sign in to comment.