Skip to content

Commit 33c9347

Browse files
authored
Merge pull request #258 from nicklewis/use-ostream-not-ofstream
(PCP-906) Use std::ostream instead of std::ofstream for logstream
2 parents a3e4353 + e648b1f commit 33c9347

File tree

11 files changed

+19
-13
lines changed

11 files changed

+19
-13
lines changed

lib/inc/cpp-pcp-client/connector/client_metadata.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class LIBCPP_PCP_CLIENT_EXPORT ClientMetadata {
2727
uint32_t pong_timeouts_before_retry;
2828
long pong_timeout_ms;
2929
leatherman::logging::log_level loglevel{};
30-
std::ofstream* logstream;
30+
std::ostream* logstream;
3131

3232
/// Throws a connection_config_error in case: the client
3333
/// certificate file does not exist or is invalid; it fails to
@@ -72,7 +72,7 @@ class LIBCPP_PCP_CLIENT_EXPORT ClientMetadata {
7272
std::string _crl,
7373
std::string proxy,
7474
leatherman::logging::log_level loglevel,
75-
std::ofstream* logstream,
75+
std::ostream* logstream,
7676
long _ws_connection_timeout_ms,
7777
uint32_t _pong_timeouts_before_retry,
7878
long _pong_timeout_ms);

lib/inc/cpp-pcp-client/connector/connection.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ class LIBCPP_PCP_CLIENT_EXPORT Connection {
122122

123123
/// WebSocket++ logging configuration
124124
void setWebSocketLogLevel(leatherman::logging::log_level loglevel);
125-
void setWebSocketLogStream(std::ofstream* logstream);
125+
void setWebSocketLogStream(std::ostream* logstream);
126126

127127
/// Check the state of the WebSocket connection; in case it's not
128128
/// open, try to re-open it.

lib/inc/cpp-pcp-client/connector/connector_base.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ class LIBCPP_PCP_CLIENT_EXPORT ConnectorBase {
7272
std::string client_crl_path,
7373
std::string ws_proxy,
7474
leatherman::logging::log_level loglevel,
75-
std::ofstream* logstream,
75+
std::ostream* logstream,
7676
long ws_connection_timeout_ms,
7777
uint32_t pong_timeouts_before_retry,
7878
long ws_pong_timeout_ms);

lib/inc/cpp-pcp-client/connector/v1/connector.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ class LIBCPP_PCP_CLIENT_EXPORT Connector : public ConnectorBase {
115115
std::string client_crl_path,
116116
std::string ws_proxy,
117117
leatherman::logging::log_level loglevel,
118-
std::ofstream* logstream,
118+
std::ostream* logstream,
119119
long ws_connection_timeout_ms = 5000,
120120
uint32_t association_timeout_s = 15,
121121
uint32_t association_request_ttl_s = 10, // Unused

lib/inc/cpp-pcp-client/connector/v2/connector.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ class LIBCPP_PCP_CLIENT_EXPORT Connector : public ConnectorBase {
102102
std::string client_crl_path,
103103
std::string ws_proxy,
104104
leatherman::logging::log_level loglevel,
105-
std::ofstream* logstream,
105+
std::ostream* logstream,
106106
long ws_connection_timeout_ms = 5000,
107107
uint32_t pong_timeouts_before_retry = 3,
108108
long ws_pong_timeout_ms = 5000);

lib/src/connector/client_metadata.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ ClientMetadata::ClientMetadata(std::string _client_type,
193193
std::string _crl,
194194
std::string _proxy,
195195
lth_log::log_level _loglevel,
196-
std::ofstream* _logstream,
196+
std::ostream* _logstream,
197197
long _ws_connection_timeout_ms,
198198
uint32_t _pong_timeouts_before_retry,
199199
long _pong_timeout_ms)

lib/src/connector/connection.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ void Connection::setWebSocketLogLevel(lth_log::log_level loglevel)
191191
}
192192
}
193193

194-
void Connection::setWebSocketLogStream(std::ofstream* logstream)
194+
void Connection::setWebSocketLogStream(std::ostream* logstream)
195195
{
196196
if (logstream != nullptr) {
197197
endpoint_->get_alog().set_ostream(logstream);

lib/src/connector/connector_base.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ ConnectorBase::ConnectorBase(std::vector<std::string> broker_ws_uris,
113113
std::string client_crl_path,
114114
std::string ws_proxy,
115115
lth_log::log_level loglevel,
116-
std::ofstream* logstream,
116+
std::ostream* logstream,
117117
long ws_connection_timeout_ms,
118118
uint32_t pong_timeouts_before_retry,
119119
long ws_pong_timeout_ms)

lib/src/connector/v1/connector.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ Connector::Connector(std::vector<std::string> broker_ws_uris,
270270
std::string client_crl_path,
271271
std::string ws_proxy,
272272
lth_log::log_level loglevel,
273-
std::ofstream* logstream,
273+
std::ostream* logstream,
274274
long ws_connection_timeout_ms,
275275
uint32_t association_timeout_s,
276276
uint32_t association_request_ttl_s,

lib/src/connector/v2/connector.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ Connector::Connector(std::vector<std::string> broker_ws_uris,
213213
std::string client_crl_path,
214214
std::string ws_proxy,
215215
lth_log::log_level loglevel,
216-
std::ofstream* logstream,
216+
std::ostream* logstream,
217217
long ws_connection_timeout_ms,
218218
uint32_t pong_timeouts_before_retry,
219219
long ws_pong_timeout_ms)

0 commit comments

Comments
 (0)