Skip to content

Commit 75e0589

Browse files
authored
feat: allow disabling the logging of the library (#399)
1 parent 9d55f6e commit 75e0589

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ PROJECT(sioclient
77
option(BUILD_SHARED_LIBS "Build the shared library" OFF)
88
option(BUILD_UNIT_TESTS "Builds unit tests target" OFF)
99
option(USE_SUBMODULES "Use source in local submodules instead of system libraries" ON)
10+
option(DISABLE_LOGGING "Do not print logging messages" OFF)
1011

1112
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
1213
set(DEFAULT_BUILD_TYPE "Release")
@@ -39,6 +40,10 @@ add_definitions(
3940
-D_WEBSOCKETPP_CPP11_CHRONO_
4041
)
4142

43+
if (DISABLE_LOGGING)
44+
add_definitions(-DSIO_DISABLE_LOGGING)
45+
endif()
46+
4247
set(ALL_SRC
4348
"src/sio_client.cpp"
4449
"src/sio_socket.cpp"

src/internal/sio_client_impl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
#include <mutex>
1414
#include <cmath>
1515
// Comment this out to disable handshake logging to stdout
16-
#if DEBUG || _DEBUG
16+
#if (DEBUG || _DEBUG) && !defined(SIO_DISABLE_LOGGING)
1717
#define LOG(x) std::cout << x
1818
#else
1919
#define LOG(x)

0 commit comments

Comments
 (0)